[gegl] write-buffer: make the node of write-buffer emit computed events.



commit e37dcb224971babaf367ed129596dfab48b8e8e0
Author: Ãyvind KolÃs <pippin gimp org>
Date:   Mon Mar 12 23:24:48 2012 +0000

    write-buffer: make the node of write-buffer emit computed events.
    
    At the moment this is added just to this node, this might be a signal that
    should be generally possible to expect to be fired on nodes.

 gegl/graph/gegl-node.c           |   11 +++++++++--
 gegl/graph/gegl-node.h           |    3 +++
 gegl/operation/gegl-operation.c  |    3 +++
 operations/common/write-buffer.c |   17 +++++++++++++++++
 4 files changed, 32 insertions(+), 2 deletions(-)
---
diff --git a/gegl/graph/gegl-node.c b/gegl/graph/gegl-node.c
index 258b8b7..1be5753 100644
--- a/gegl/graph/gegl-node.c
+++ b/gegl/graph/gegl-node.c
@@ -1974,14 +1974,21 @@ gegl_node_get_consumers (GeglNode      *node,
   return n_connections;
 }
 
+
+void
+gegl_node_emit_computed (GeglNode *node,
+                         const GeglRectangle *rect)
+{
+  g_signal_emit (node, gegl_node_signals[COMPUTED], 0, rect, NULL, NULL);
+}
+
 static void
 gegl_node_computed_event (GeglCache *self,
                           void      *foo,
                           void      *user_data)
 {
   GeglNode *node = GEGL_NODE (user_data);
-
-  g_signal_emit (node, gegl_node_signals[COMPUTED], 0, foo, NULL, NULL);
+  gegl_node_emit_computed (node, foo);
 }
 
 GeglCache *
diff --git a/gegl/graph/gegl-node.h b/gegl/graph/gegl-node.h
index 36d969b..46a7b35 100644
--- a/gegl/graph/gegl-node.h
+++ b/gegl/graph/gegl-node.h
@@ -221,6 +221,9 @@ GeglRectangle gegl_node_get_bounding_box    (GeglNode      *root);
 const gchar * gegl_node_get_name            (GeglNode      *self);
 void          gegl_node_set_name            (GeglNode      *self,
                                              const gchar   *name);
+void
+gegl_node_emit_computed (GeglNode *node,
+                         const GeglRectangle *rect);
 
 /* macros used to set flags on objects passed in the graph */
 
diff --git a/gegl/operation/gegl-operation.c b/gegl/operation/gegl-operation.c
index c327c7d..2d4e55b 100644
--- a/gegl/operation/gegl-operation.c
+++ b/gegl/operation/gegl-operation.c
@@ -100,6 +100,9 @@ gegl_operation_create_pad (GeglOperation *self,
   gegl_node_add_pad (self->node, pad);
 }
 
+void gegl_node_emit_computed (GeglNode *node, const GeglRectangle *rect);
+
+
 gboolean
 gegl_operation_process (GeglOperation       *operation,
                         GeglOperationContext     *context,
diff --git a/operations/common/write-buffer.c b/operations/common/write-buffer.c
index 364804f..bd8dfca 100644
--- a/operations/common/write-buffer.c
+++ b/operations/common/write-buffer.c
@@ -44,11 +44,26 @@ process (GeglOperation       *operation,
       GeglBuffer *output = GEGL_BUFFER (o->buffer);
 
       gegl_buffer_copy (input, result, output, result);
+      gegl_buffer_flush (output);
+      gegl_node_emit_computed (operation->node, result);
     }
 
   return TRUE;
 }
 
+static void
+dispose (GObject *object)
+{
+  GeglChantO *o = GEGL_CHANT_PROPERTIES (object);
+
+  if (o->buffer)
+    {
+      g_object_unref (o->buffer);
+      o->buffer = NULL;
+    }
+
+  G_OBJECT_CLASS (gegl_chant_parent_class)->dispose (object);
+}
 
 static void
 gegl_chant_class_init (GeglChantClass *klass)
@@ -62,6 +77,8 @@ gegl_chant_class_init (GeglChantClass *klass)
   sink_class->process = process;
   sink_class->needs_full = FALSE;
 
+  G_OBJECT_CLASS (klass)->dispose = dispose;
+
   operation_class->name        = "gegl:write-buffer";
   operation_class->categories  = "programming:output";
   operation_class->description = _("A GEGL buffer destination surface.");



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