gegl r2711 - in trunk: . gegl/operation
- From: ok svn gnome org
- To: svn-commits-list gnome org
- Subject: gegl r2711 - in trunk: . gegl/operation
- Date: Sun, 9 Nov 2008 15:58:49 +0000 (UTC)
Author: ok
Date: Sun Nov 9 15:58:49 2008
New Revision: 2711
URL: http://svn.gnome.org/viewvc/gegl?rev=2711&view=rev
Log:
* gegl/operation/gegl-operation-context.c: (emptybuf),
(gegl_operation_context_get_target): keep an 0x0 sized buffer around
that is shared by all needs for such a buffer to be passed as a dummy
token between nodes.
Modified:
trunk/ChangeLog
trunk/gegl/operation/gegl-operation-context.c
Modified: trunk/gegl/operation/gegl-operation-context.c
==============================================================================
--- trunk/gegl/operation/gegl-operation-context.c (original)
+++ trunk/gegl/operation/gegl-operation-context.c Sun Nov 9 15:58:49 2008
@@ -323,6 +323,20 @@
return input;
}
+static GeglBuffer *emptybuf (void)
+{
+ static GeglBuffer *empty = NULL; /* we leak this single empty buffer,
+ avoiding having to create it weighs
+ up the penalty.
+ */
+ if (!empty)
+ {
+ GeglRectangle rect={0,0,0,0};
+ empty = gegl_buffer_new (&empty, babl_format ("RGBA float"));
+ }
+ return empty;
+}
+
GeglBuffer *
gegl_operation_context_get_target (GeglOperationContext *context,
const gchar *padname)
@@ -350,12 +364,17 @@
result = &context->result_rect;
- if (node->dont_cache == FALSE &&
+ if (result->width == 0 ||
+ result->height == 0)
+ {
+ output = g_object_ref (emptybuf());
+ }
+ else if (node->dont_cache == FALSE &&
! GEGL_OPERATION_CLASS (G_OBJECT_GET_CLASS (operation))->no_cache)
{
- GeglBuffer *cache;
- cache = GEGL_BUFFER (gegl_node_get_cache (node));
- output = gegl_buffer_create_sub_buffer (cache, result);
+ GeglBuffer *cache;
+ cache = GEGL_BUFFER (gegl_node_get_cache (node));
+ output = gegl_buffer_create_sub_buffer (cache, result);
}
else
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]