gegl r2302 - in trunk: . gegl/graph



Author: ok
Date: Sat May 17 15:19:48 2008
New Revision: 2302
URL: http://svn.gnome.org/viewvc/gegl?rev=2302&view=rev

Log:
* gegl/graph/gegl-node.[ch]:  added a "dont-cache" property to make a
GeglNode (and it's children) avoid allocating cache buffers and
instead pass temporary buffers.
* gegl/graph/gegl-node-context.c: (gegl_node_context_get_target): obey
the request to not use a cache.


Modified:
   trunk/ChangeLog
   trunk/gegl/graph/gegl-node-context.c
   trunk/gegl/graph/gegl-node.c
   trunk/gegl/graph/gegl-node.h

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 15:19:48 2008
@@ -342,6 +342,7 @@
   result = &context->result_rect;
 
   if (gegl_config()->node_caches &&
+      node->dont_cache == FALSE &&
       ! GEGL_OPERATION_CLASS (G_OBJECT_GET_CLASS (operation))->no_cache)
     {
           GeglBuffer    *cache;

Modified: trunk/gegl/graph/gegl-node.c
==============================================================================
--- trunk/gegl/graph/gegl-node.c	(original)
+++ trunk/gegl/graph/gegl-node.c	Sat May 17 15:19:48 2008
@@ -53,7 +53,8 @@
   PROP_0,
   PROP_OP_CLASS,
   PROP_OPERATION,
-  PROP_NAME
+  PROP_NAME,
+  PROP_DONT_CACHE
 };
 
 enum
@@ -149,6 +150,14 @@
                                                         G_PARAM_CONSTRUCT |
                                                         G_PARAM_READWRITE));
 
+  g_object_class_install_property (gobject_class, PROP_DONT_CACHE,
+                                   g_param_spec_boolean ("dont-cache",
+                                                         "Do not cache",
+                                                        "Do not cache the result of this operation, the property is inherithed by children created from a node.",
+                                                        TRUE, 
+                                                        G_PARAM_READWRITE));
+
+
   g_object_class_install_property (gobject_class, PROP_NAME,
                                    g_param_spec_string ("name",
                                                         "Name",
@@ -303,6 +312,10 @@
         gegl_node_set_name (node, g_value_get_string (value));
         break;
 
+      case PROP_DONT_CACHE:
+        node->dont_cache = g_value_get_boolean (value);
+        break;
+
       case PROP_OP_CLASS:
         gegl_node_set_op_class (node, g_value_get_string (value), NULL, NULL);
         break;
@@ -332,6 +345,9 @@
           g_value_set_string (value, GEGL_OPERATION_GET_CLASS (node->operation)->name);
         break;
 
+      case PROP_DONT_CACHE:
+        g_value_set_boolean (value, node->dont_cache);
+        break;
       case PROP_NAME:
         g_value_set_string (value, gegl_node_get_name (node));
         break;
@@ -1898,6 +1914,8 @@
   self->is_graph = TRUE;
   child_priv->parent  = self;
 
+  child->dont_cache = self->dont_cache;
+
   return child;
 }
 
@@ -2027,7 +2045,9 @@
 
   node = g_object_new (GEGL_TYPE_NODE, NULL);
   if (parent)
-    gegl_node_add_child (parent, node);
+    {
+      gegl_node_add_child (parent, node);
+    }
 
   name = first_property_name;
   va_start (var_args, first_property_name);
@@ -2043,9 +2063,15 @@
 gegl_node_create_child (GeglNode    *self,
                         const gchar *operation)
 {
+  GeglNode *ret;
   g_return_val_if_fail (operation != NULL, NULL);
 
-  return gegl_node_new_child (self, "operation", operation, NULL);
+  ret = gegl_node_new_child (self, "operation", operation, NULL);
+  if (ret && self)
+    {
+      ret->dont_cache = self->dont_cache;
+    }
+  return ret;
 }
 
 static void

Modified: trunk/gegl/graph/gegl-node.h
==============================================================================
--- trunk/gegl/graph/gegl-node.h	(original)
+++ trunk/gegl/graph/gegl-node.h	Sat May 17 15:19:48 2008
@@ -63,6 +63,8 @@
                              reused for all subsequent requests for the cache
                              object.*/
 
+  gboolean        dont_cache; /* whether result is cached or not, inherited
+                                 by children */
   GMutex          *mutex;
 
   /*< private >*/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]