[gegl] Share an empty buffer



commit 565853290dbdaa6475e74e53ecda76d8706e291d
Author: �yvind Kolås <pippin gimp org>
Date:   Thu Nov 12 17:38:13 2009 +0000

    Share an empty buffer

 gegl/operation/gegl-operation-context.c |    5 +++--
 gegl/operation/gegl-operation.c         |    4 +++-
 2 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/gegl/operation/gegl-operation-context.c b/gegl/operation/gegl-operation-context.c
index 414b377..526e928 100644
--- a/gegl/operation/gegl-operation-context.c
+++ b/gegl/operation/gegl-operation-context.c
@@ -324,7 +324,8 @@ gegl_operation_context_get_source (GeglOperationContext *context,
   return input;
 }
 
-static GeglBuffer *emptybuf (void)
+GeglBuffer *gegl_buffer_emptybuf (void);
+GeglBuffer *gegl_buffer_emptybuf (void)
 {
   static GeglBuffer *empty = NULL; /* we leak this single empty buffer,
                                       avoiding having to create it weighs
@@ -370,7 +371,7 @@ gegl_operation_context_get_target (GeglOperationContext *context,
   if (result->width == 0 ||
       result->height == 0)
     {
-      output = g_object_ref (emptybuf());
+      output = g_object_ref (gegl_buffer_emptybuf());
     }
   else if (node->dont_cache == FALSE &&
       ! GEGL_OPERATION_CLASS (G_OBJECT_GET_CLASS (operation))->no_cache)
diff --git a/gegl/operation/gegl-operation.c b/gegl/operation/gegl-operation.c
index 8df8e70..6505976 100644
--- a/gegl/operation/gegl-operation.c
+++ b/gegl/operation/gegl-operation.c
@@ -100,6 +100,8 @@ gegl_operation_create_pad (GeglOperation *self,
   gegl_node_add_pad (self->node, pad);
 }
 
+GeglBuffer *gegl_buffer_emptybuf (void);
+
 gboolean
 gegl_operation_process (GeglOperation       *operation,
                         GeglOperationContext     *context,
@@ -115,7 +117,7 @@ gegl_operation_process (GeglOperation       *operation,
   if (!strcmp (output_pad, "output") &&
       (result->width == 0 || result->height == 0))
     {
-      GeglBuffer *output = gegl_buffer_new (NULL, NULL);
+      GeglBuffer *output = g_object_ref (gegl_buffer_emptybuf ());
       gegl_operation_context_take_object (context, "output", G_OBJECT (output));
       return TRUE;
     }



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