gegl r3027 - trunk/gegl/operation



Author: martinn
Date: Sat Apr 11 12:57:45 2009
New Revision: 3027
URL: http://svn.gnome.org/viewvc/gegl?rev=3027&view=rev

Log:
gegl: Don't use node cache if out of bounds

Only use the cache if the result is within the cache extent. This is
certainly not optimal. My gut feeling is that the current caching
mechanism needs to be redesigned

Modified:
   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	Sat Apr 11 12:57:45 2009
@@ -24,6 +24,7 @@
 #include <glib-object.h>
 
 #include "gegl.h"
+#include "gegl/gegl-utils.h"
 #include "gegl-types-internal.h"
 #include "gegl-operation-context.h"
 #include "gegl/graph/gegl-node.h"
@@ -368,7 +369,19 @@
     {
       GeglBuffer    *cache;
       cache = GEGL_BUFFER (gegl_node_get_cache (node));
-      output = gegl_buffer_create_sub_buffer (cache, result);
+
+      /* Only use the cache if the result is within the cache
+       * extent. This is certainly not optimal. My gut feeling is that
+       * the current caching mechanism needs to be redesigned
+       */
+      if (gegl_rectangle_contains (gegl_buffer_get_extent (cache), result))
+        {
+          output = gegl_buffer_create_sub_buffer (cache, result);
+        }
+      else
+        {
+          output = gegl_buffer_new_ram (result, format);
+        }
     }
   else
     {



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