gegl r2378 - in trunk: . gegl/buffer gegl/operation



Author: ok
Date: Tue Jun  3 23:11:31 2008
New Revision: 2378
URL: http://svn.gnome.org/viewvc/gegl?rev=2378&view=rev

Log:
* gegl/buffer/gegl-buffer-private.h: added roi to scan iterator
struct, removed accesor macro.
* gegl/buffer/gegl-buffer-access.c: handle roi of scan iterator
internally.
Updated code using scan iterator to use roi from iterator struct.
* gegl/operation/gegl-operation-point-composer.c:
* gegl/operation/gegl-operation-point-filter.c:
* gegl/operation/gegl-operation-point-render.c:


Modified:
   trunk/ChangeLog
   trunk/gegl/buffer/gegl-buffer-access.c
   trunk/gegl/buffer/gegl-buffer-private.h
   trunk/gegl/operation/gegl-operation-point-composer.c
   trunk/gegl/operation/gegl-operation-point-filter.c
   trunk/gegl/operation/gegl-operation-point-render.c

Modified: trunk/gegl/buffer/gegl-buffer-access.c
==============================================================================
--- trunk/gegl/buffer/gegl-buffer-access.c	(original)
+++ trunk/gegl/buffer/gegl-buffer-access.c	Tue Jun  3 23:11:31 2008
@@ -43,6 +43,22 @@
 #endif
 
 
+#define gegl_buffer_scan_iterator_get_x(i) \
+    ((((GeglBufferTileIterator*)(i))->roi.x) + \
+    (((GeglBufferTileIterator*)(i))->real_col))
+#define gegl_buffer_scan_iterator_get_y(i) \
+    ( (((GeglBufferTileIterator*)(i))->roi.y)+ \
+      (((GeglBufferTileIterator*)(i))->real_row)+ \
+      ((GeglBufferScanIterator*)(i))->real_row)
+
+#define gegl_buffer_scan_iterator_get_rectangle(i,rect_ptr) \
+  do{GeglRectangle *foo = rect_ptr;\
+   if (foo) {\
+   foo->x=gegl_buffer_scan_iterator_get_x(i);\
+   foo->y=gegl_buffer_scan_iterator_get_y(i);\
+   foo->width= ((GeglBufferTileIterator*)i)->subrect.width;\
+   foo->height=((GeglBufferScanIterator*)i)->length/ foo->width;\
+   }}while(0)
 
 void gegl_buffer_tile_iterator_init (GeglBufferTileIterator *i,
                                      GeglBuffer             *buffer,
@@ -130,6 +146,7 @@
         {
           return FALSE;
         }*/
+      gegl_buffer_scan_iterator_get_rectangle (i, &(i->roi));
       return TRUE;
     }
   else if (i->row < tile_i->subrect.height)
@@ -1475,11 +1492,6 @@
       while (  (a = gegl_buffer_scan_iterator_next (&read)) &&
                (b = gegl_buffer_scan_iterator_next (&write)))
         {
-          GeglRectangle roi;
-          gegl_buffer_scan_iterator_get_rectangle (&write, &roi);
-          /* XXX: check if we have a full tile, if we do we can clone
-           * it
-           */
           g_assert (read.length == write.length);
           babl_process (fish, read.data, write.data, write.length);
         }

Modified: trunk/gegl/buffer/gegl-buffer-private.h
==============================================================================
--- trunk/gegl/buffer/gegl-buffer-private.h	(original)
+++ trunk/gegl/buffer/gegl-buffer-private.h	Tue Jun  3 23:11:31 2008
@@ -124,24 +124,11 @@
   gint                   row;
   gint                   real_row;
   gpointer               data;
+  GeglRectangle          roi;
 } GeglBufferScanIterator;
 
-#define gegl_buffer_scan_iterator_get_x(i) \
-    ((((GeglBufferTileIterator*)(i))->roi.x) + \
-    (((GeglBufferTileIterator*)(i))->real_col))
-#define gegl_buffer_scan_iterator_get_y(i) \
-    ( (((GeglBufferTileIterator*)(i))->roi.y)+ \
-      (((GeglBufferTileIterator*)(i))->real_row)+ \
-      ((GeglBufferScanIterator*)(i))->real_row)
-
-#define gegl_buffer_scan_iterator_get_rectangle(i,rect_ptr) \
-  do{GeglRectangle *foo = rect_ptr;\
-   if (foo) {\
-   foo->x=gegl_buffer_scan_iterator_get_x(i);\
-   foo->y=gegl_buffer_scan_iterator_get_y(i);\
-   foo->width= ((GeglBufferTileIterator*)i)->subrect.width;\
-   foo->height=((GeglBufferScanIterator*)i)->length/ foo->width;\
-   }}while(0)
+
+
 
 
 gboolean                gegl_buffer_tile_iterator_next (GeglBufferTileIterator *i);

Modified: trunk/gegl/operation/gegl-operation-point-composer.c
==============================================================================
--- trunk/gegl/operation/gegl-operation-point-composer.c	(original)
+++ trunk/gegl/operation/gegl-operation-point-composer.c	Tue Jun  3 23:11:31 2008
@@ -223,7 +223,6 @@
 	 /* FIXME use direct access when possible (avoid conversions and buffers) 
           */
            {
-              GeglRectangle roi;
               if (aux)
                 aux_buf = gegl_malloc (aux_bpp * write.max_size);
 
@@ -233,11 +232,9 @@
                   while (  (a = gegl_buffer_scan_iterator_next (&read)) &&
                            (b = gegl_buffer_scan_iterator_next (&write)))
                     {
-                   gegl_buffer_scan_iterator_get_rectangle (&write, &roi);
-
                    g_assert (read.length == write.length);
 
-                   if (aux) gegl_buffer_get (aux, 1.0, &roi, aux_format, aux_buf,
+                   if (aux) gegl_buffer_get (aux, 1.0, &write.roi, aux_format, aux_buf,
                                              GEGL_AUTO_ROWSTRIDE);
 
                    GEGL_OPERATION_POINT_COMPOSER_GET_CLASS (operation)->process (
@@ -255,11 +252,9 @@
                   while (  (a = gegl_buffer_scan_iterator_next (&read)) &&
                            (b = gegl_buffer_scan_iterator_next (&write)))
                     {
-                      gegl_buffer_scan_iterator_get_rectangle (&write, &roi);
-
                       g_assert (read.length == write.length);
 
-                      if (aux) gegl_buffer_get (aux, 1.0, &roi, aux_format, aux_buf,
+                      if (aux) gegl_buffer_get (aux, 1.0, &write.roi, aux_format, aux_buf,
                                                 GEGL_AUTO_ROWSTRIDE);
 
                       GEGL_OPERATION_POINT_COMPOSER_GET_CLASS (operation)->process (
@@ -279,12 +274,10 @@
                   while (  (a = gegl_buffer_scan_iterator_next (&read)) &&
                            (b = gegl_buffer_scan_iterator_next (&write)))
                     {
-                      gegl_buffer_scan_iterator_get_rectangle (&write, &roi);
-
                       g_assert (read.length == write.length);
                       babl_process (infish, read.data, in_buf, read.length);
 
-                      if (aux) gegl_buffer_get (aux, 1.0, &roi, aux_format, aux_buf,
+                      if (aux) gegl_buffer_get (aux, 1.0, &write.roi, aux_format, aux_buf,
                                                 GEGL_AUTO_ROWSTRIDE);
 
                       GEGL_OPERATION_POINT_COMPOSER_GET_CLASS (operation)->process (
@@ -304,12 +297,10 @@
                   while (  (a = gegl_buffer_scan_iterator_next (&read)) &&
                            (b = gegl_buffer_scan_iterator_next (&write)))
                     {
-                      gegl_buffer_scan_iterator_get_rectangle (&write, &roi);
-
                       g_assert (read.length == write.length);
                       babl_process (infish, read.data, in_buf, read.length);
 
-                      if (aux) gegl_buffer_get (aux, 1.0, &roi, aux_format, aux_buf,
+                      if (aux) gegl_buffer_get (aux, 1.0, &write.roi, aux_format, aux_buf,
                                                 GEGL_AUTO_ROWSTRIDE);
 
                       GEGL_OPERATION_POINT_COMPOSER_GET_CLASS (operation)->process (

Modified: trunk/gegl/operation/gegl-operation-point-filter.c
==============================================================================
--- trunk/gegl/operation/gegl-operation-point-filter.c	(original)
+++ trunk/gegl/operation/gegl-operation-point-filter.c	Tue Jun  3 23:11:31 2008
@@ -108,10 +108,8 @@
               while (  (a = gegl_buffer_scan_iterator_next (&read)) &&
                        (b = gegl_buffer_scan_iterator_next (&write)))
                 {
-                  GeglRectangle roi;
-                  gegl_buffer_scan_iterator_get_rectangle (&write, &roi);
                   g_assert (read.length == write.length);
-                  point_filter_class->process (operation, read.data, write.data, write.length, &roi);
+                  point_filter_class->process (operation, read.data, write.data, write.length, &write.roi);
                 }
             }
           else if (in_format == input->format &&
@@ -121,10 +119,8 @@
               while (  (a = gegl_buffer_scan_iterator_next (&read)) &&
                        (b = gegl_buffer_scan_iterator_next (&write)))
                 {
-                  GeglRectangle roi;
-                  gegl_buffer_scan_iterator_get_rectangle (&write, &roi);
                   g_assert (read.length == write.length);
-                  point_filter_class->process (operation, read.data, out_buf, read.length, &roi);
+                  point_filter_class->process (operation, read.data, out_buf, read.length, &write.roi);
                   babl_process (outfish, out_buf, write.data, write.length);
                 }
             }
@@ -135,20 +131,16 @@
               while (  (a = gegl_buffer_scan_iterator_next (&read)) &&
                        (b = gegl_buffer_scan_iterator_next (&write)))
                 {
-                  GeglRectangle roi;
-                  gegl_buffer_scan_iterator_get_rectangle (&write, &roi);
                   if (read.length < 0)
                     continue;
                   g_assert (read.length == write.length);
                   babl_process (infish, read.data, in_buf, read.length);
-                  point_filter_class->process (operation, in_buf, write.data, read.length, &roi);
+                  point_filter_class->process (operation, in_buf, write.data, read.length, &write.roi);
                 }
             }
           else if (in_format != input->format &&
                    out_format != output->format)
             {
-              GeglRectangle roi;
-              gegl_buffer_scan_iterator_get_rectangle (&write, &roi);
               in_buf  = gegl_malloc (input_bpp * read.max_size);
               out_buf = gegl_malloc (output_bpp * write.max_size);
               while (  (a = gegl_buffer_scan_iterator_next (&read)) &&
@@ -156,7 +148,7 @@
                 {
                   g_assert (read.length == write.length);
                   babl_process (infish, read.data, in_buf, read.length);
-                  point_filter_class->process (operation, in_buf, out_buf, read.length, &roi);
+                  point_filter_class->process (operation, in_buf, out_buf, read.length, &write.roi);
                   babl_process (outfish, out_buf, write.data, write.length);
                 }
             }

Modified: trunk/gegl/operation/gegl-operation-point-render.c
==============================================================================
--- trunk/gegl/operation/gegl-operation-point-render.c	(original)
+++ trunk/gegl/operation/gegl-operation-point-render.c	Tue Jun  3 23:11:31 2008
@@ -107,10 +107,7 @@
       out_buf = gegl_malloc (output_bpp * write.max_size);
       while (gegl_buffer_scan_iterator_next (&write))
         {
-          GeglRectangle roi;
-          gegl_buffer_scan_iterator_get_rectangle (&write, &roi);
-
-          point_render_class->process (operation, out_buf, write.length, &roi);
+          point_render_class->process (operation, out_buf, write.length, &write.roi);
 
           /* this is the actual write happening directly to the underlying
            * scan on the tile.



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