gegl r2294 - in trunk: . gegl gegl/graph
- From: ok svn gnome org
- To: svn-commits-list gnome org
- Subject: gegl r2294 - in trunk: . gegl gegl/graph
- Date: Sat, 17 May 2008 12:18:09 +0100 (BST)
Author: ok
Date: Sat May 17 11:18:09 2008
New Revision: 2294
URL: http://svn.gnome.org/viewvc/gegl?rev=2294&view=rev
Log:
* gegl/gegl-config.[ch]: (get_property), (set_property),
(gegl_config_class_init), (gegl_config_init): added a node_caches
property.
* gegl/gegl-init.c: (gegl_post_parse_hook): added a
GEGL_NO_NODE_CACHES --gegl-no-node-caches configuration setter.
* gegl/graph/gegl-node-context.c: (gegl_node_context_get_target):
obey the configuration for whether to use a cache or temporary buffer
for the target buffer written to by operations.
Modified:
trunk/ChangeLog
trunk/gegl/gegl-config.c
trunk/gegl/gegl-config.h
trunk/gegl/gegl-init.c
trunk/gegl/graph/gegl-node-context.c
Modified: trunk/gegl/gegl-config.c
==============================================================================
--- trunk/gegl/gegl-config.c (original)
+++ trunk/gegl/gegl-config.c Sat May 17 11:18:09 2008
@@ -31,7 +31,8 @@
PROP_QUALITY,
PROP_CACHE_SIZE,
PROP_SWAP,
- PROP_BABL_ERROR
+ PROP_BABL_ERROR,
+ PROP_NODE_CACHES
};
static void
@@ -60,6 +61,10 @@
g_value_set_string (value, config->swap);
break;
+ case PROP_NODE_CACHES:
+ g_value_set_boolean (value, config->node_caches);
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, property_id, pspec);
break;
@@ -88,8 +93,9 @@
config->babl_error = g_value_get_double (value);
g_sprintf (buf, "%f", config->babl_error);
g_setenv ("BABL_ERROR", buf, 0);
- /* babl picks up the babl error through the environment,
- * not sure if it is cached or not
+ /* babl picks up the babl error through the environment, babl
+ * caches valid conversions though so this needs to be set
+ * before any processing is done
*/
}
return;
@@ -98,7 +104,9 @@
g_free (config->swap);
config->swap = g_value_dup_string (value);
break;
-
+ case PROP_NODE_CACHES:
+ config->node_caches = g_value_get_boolean (value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, property_id, pspec);
break;
@@ -127,6 +135,10 @@
gobject_class->get_property = get_property;
gobject_class->finalize = finalize;
+ g_object_class_install_property (gobject_class, PROP_NODE_CACHES,
+ g_param_spec_boolean ("node-caches", "Node caches", "Whether GEGL caches the results at each node in the graph.", TRUE,
+ G_PARAM_READWRITE));
+
g_object_class_install_property (gobject_class, PROP_CACHE_SIZE,
g_param_spec_double ("cachei-size", "Cache size", "size of cache in bytes",
0.0, 1.0, 1.0,
@@ -153,4 +165,5 @@
self->swap = NULL;
self->quality = 1.0;
self->cache_size = 256*1024*1024;
+ self->node_caches = TRUE;
}
Modified: trunk/gegl/gegl-config.h
==============================================================================
--- trunk/gegl/gegl-config.h (original)
+++ trunk/gegl/gegl-config.h Sat May 17 11:18:09 2008
@@ -36,12 +36,13 @@
struct _GeglConfig
{
- GObject parent_instance;
+ GObject parent_instance;
- gchar *swap;
- gint cache_size;
- gdouble quality;
- gdouble babl_error;
+ gchar *swap;
+ gint cache_size;
+ gdouble quality;
+ gdouble babl_error;
+ gboolean node_caches;
};
struct _GeglConfigClass
@@ -49,7 +50,6 @@
GObjectClass parent_class;
};
-
GType gegl_config_get_type (void) G_GNUC_CONST;
#ifndef __GEGL_INIT_H__
GeglConfig * gegl_config (void);
Modified: trunk/gegl/gegl-init.c
==============================================================================
--- trunk/gegl/gegl-init.c (original)
+++ trunk/gegl/gegl-init.c Sat May 17 11:18:09 2008
@@ -164,6 +164,7 @@
static gchar *cmd_gegl_cache_size=NULL;
static gchar *cmd_gegl_quality=NULL;
static gchar *cmd_babl_error=NULL;
+static gboolean cmd_no_node_caches=FALSE;
static const GOptionEntry cmd_entries[]=
{
@@ -183,6 +184,11 @@
N_("How much memory to (approximately) use for caching imagery"), "<megabytes>"
},
{
+ "gegl-no-node-caches", 0, 0,
+ G_OPTION_ARG_NONE, &cmd_no_node_caches,
+ N_("Don't use per node caches to speed up _re_evaluation of the graph"),
+ },
+ {
"gegl-quality", 0, 0,
G_OPTION_ARG_STRING, &cmd_gegl_quality,
N_("The quality of rendering a value between 0.0(fast) and 1.0(reference)"), "<quality>"
@@ -350,7 +356,9 @@
if (g_getenv ("GEGL_CACHE_SIZE"))
config->cache_size = atoi(g_getenv("GEGL_CACHE_SIZE"))* 1024*1024;
-
+ config->node_caches = !cmd_no_node_caches;
+ if (g_getenv ("GEGL_NO_NODE_CACHES"))
+ g_object_set (config, "node-caches", FALSE, NULL);
if (gegl_swap_dir())
config->swap = g_strdup(gegl_swap_dir ());
if (cmd_gegl_swap)
Modified: trunk/gegl/graph/gegl-node-context.c
==============================================================================
--- trunk/gegl/graph/gegl-node-context.c (original)
+++ trunk/gegl/graph/gegl-node-context.c Sat May 17 11:18:09 2008
@@ -30,6 +30,7 @@
#include "gegl-node-context.h"
#include "gegl-node.h"
#include "gegl-pad.h"
+#include "gegl-config.h"
#include "operation/gegl-operation.h"
@@ -337,20 +338,17 @@
result = &context->result_rect;
-#if 1 /* change to 0 to disable per node caches */
- if (GEGL_OPERATION_CLASS (G_OBJECT_GET_CLASS (operation))->no_cache)
+ if (gegl_config()->node_caches &&
+ ! GEGL_OPERATION_CLASS (G_OBJECT_GET_CLASS (operation))->no_cache)
{
- output = gegl_buffer_new (result, format);
+ GeglBuffer *cache;
+ cache = GEGL_BUFFER (gegl_node_get_cache (node));
+ output = gegl_buffer_create_sub_buffer (cache, result);
}
else
{
- GeglBuffer *cache;
- cache = GEGL_BUFFER (gegl_node_get_cache (node));
- output = gegl_buffer_create_sub_buffer (cache, result);
- }
-#else
- output = gegl_buffer_new (result, format);
-#endif
+ output = gegl_buffer_new (result, format);
+ }
gegl_node_context_set_object (context, padname, G_OBJECT (output));
return output;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]