gegl r2725 - in trunk: . gegl/buffer gegl/property-types



Author: ok
Date: Mon Nov 10 23:21:28 2008
New Revision: 2725
URL: http://svn.gnome.org/viewvc/gegl?rev=2725&view=rev

Log:
* gegl/buffer/gegl-cache.c: (gegl_rectangle_expand),
(node_invalidated), (gegl_cache_invalidate):  expand invalidated
regions to be align with coordinates divisible by 8 in both
directions. This improves improves the performance of GeglProcessor
when it iterates the resulting dirtied rectangles in the GeglRegion.
* gegl/property-types/gegl-path.c: removed similar expansion.


Modified:
   trunk/ChangeLog
   trunk/gegl/buffer/gegl-cache.c
   trunk/gegl/property-types/gegl-path.c

Modified: trunk/gegl/buffer/gegl-cache.c
==============================================================================
--- trunk/gegl/buffer/gegl-cache.c	(original)
+++ trunk/gegl/buffer/gegl-cache.c	Mon Nov 10 23:21:28 2008
@@ -84,6 +84,31 @@
   return object;
 }
 
+/* expand invalidated regions to be align with coordinates divisible by 8 in both
+ * directions. This improves improves the performance of GeglProcessor when it
+ * iterates the resulting dirtied rectangles in the GeglRegion.
+ */
+static GeglRectangle gegl_rectangle_expand (const GeglRectangle *rectangle)
+{
+  gint align = 8;
+  GeglRectangle expanded = *rectangle;
+  gint xdiff;
+  gint ydiff;
+
+  xdiff = expanded.x % align;
+  expanded.width += xdiff;
+  expanded.x -= xdiff;
+  xdiff = align -(expanded.width % align);
+  expanded.width += xdiff;
+
+  ydiff = expanded.y % align;
+  expanded.height += ydiff;
+  expanded.y -= ydiff;
+  ydiff = align -(expanded.height % align);
+  expanded.height += ydiff;
+
+  return expanded;
+}
 
 static void
 gegl_cache_class_init (GeglCacheClass *klass)
@@ -204,15 +229,16 @@
                   gpointer             data)
 {
   GeglCache *cache = GEGL_CACHE (data);
+  GeglRectangle expanded = gegl_rectangle_expand (rect);
 
   {
     GeglRegion *region;
-    region = gegl_region_rectangle (rect);
+    region = gegl_region_rectangle (&expanded);
     gegl_region_subtract (cache->valid_region, region);
     gegl_region_destroy (region);
   }
 
-  g_signal_emit_by_name (cache, "invalidated", rect, NULL);
+  g_signal_emit_by_name (cache, "invalidated", &expanded, NULL);
 }
 
 static void
@@ -340,10 +366,14 @@
       g_warning ("XXX: full invalidation of GeglCache NYI\n");
     }
 #endif
+
+
   if (roi)
     {
+      GeglRectangle expanded = gegl_rectangle_expand (roi);
+
       GeglRegion *temp_region;
-      temp_region = gegl_region_rectangle (roi);
+      temp_region = gegl_region_rectangle (&expanded);
       gegl_region_subtract (self->valid_region, temp_region);
       gegl_region_destroy (temp_region);
       g_signal_emit (self, gegl_cache_signals[INVALIDATED], 0,

Modified: trunk/gegl/property-types/gegl-path.c
==============================================================================
--- trunk/gegl/property-types/gegl-path.c	(original)
+++ trunk/gegl/property-types/gegl-path.c	Mon Nov 10 23:21:28 2008
@@ -1373,25 +1373,6 @@
           rect.y=y1;
           rect.height = y0-y1;
         }
-
-      {
-        gint x0,y0,x1,y1;
-        x0 = rect.x;
-        y0 = rect.y;
-        x1 = x0 + rect.width;
-        y1 = y0 + rect.height;
-
-        x0 = x0 & (0xffffff-15);
-        y0 = y0 & (0xffffff-15);
-
-        x1 = (x1+15) & (0xffffff-15);
-        y1 = (y1+15) & (0xffffff-15);
-
-        rect.x=x0;
-        rect.y=y0;
-        rect.width = x1-x0;
-        rect.height = y1-y0;
-      }
       
       if (priv->length_clean)
         priv->length += len;



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