[gimp/gimp-2-10] app: migrate gegl-loops to new iterator api



commit 3daafb09b61b2649811473ee4347de816dfdcd0b
Author: Øyvind Kolås <pippin gimp org>
Date:   Tue Sep 11 00:35:50 2018 +0200

    app: migrate gegl-loops to new iterator api
    
    (cherry picked from commit 567ffe94ff3bc1c1c7cb2a9267fa33595899197d)

 app/gegl/gimp-gegl-loops.cc | 75 +++++++++++++++++++++++----------------------
 1 file changed, 38 insertions(+), 37 deletions(-)
---
diff --git a/app/gegl/gimp-gegl-loops.cc b/app/gegl/gimp-gegl-loops.cc
index d4bb732175..d1edbf17cb 100644
--- a/app/gegl/gimp-gegl-loops.cc
+++ b/app/gegl/gimp-gegl-loops.cc
@@ -24,6 +24,7 @@
 
 #include <cairo.h>
 #include <gdk-pixbuf/gdk-pixbuf.h>
+#define GEGL_ITERATOR2_API
 #include <gegl.h>
 
 extern "C"
@@ -170,22 +171,22 @@ gimp_gegl_convolve (GeglBuffer          *src_buffer,
 
       /* Set up dest iterator */
       dest_iter = gegl_buffer_iterator_new (dest_buffer, dest_area, 0, dest_format,
-                                            GEGL_ACCESS_WRITE, GEGL_ABYSS_NONE);
+                                            GEGL_ACCESS_WRITE, GEGL_ABYSS_NONE, 1);
 
       while (gegl_buffer_iterator_next (dest_iter))
         {
           /*  Convolve the src image using the convolution kernel, writing
            *  to dest Convolve is not tile-enabled--use accordingly
            */
-          gfloat     *dest    = (gfloat *) dest_iter->data[0];
+          gfloat     *dest    = (gfloat *) dest_iter->items[0].data;
           const gint  x1      = 0;
           const gint  y1      = 0;
           const gint  x2      = src_rect->width  - 1;
           const gint  y2      = src_rect->height - 1;
-          const gint  dest_x1 = dest_iter->roi[0].x;
-          const gint  dest_y1 = dest_iter->roi[0].y;
-          const gint  dest_x2 = dest_iter->roi[0].x + dest_iter->roi[0].width;
-          const gint  dest_y2 = dest_iter->roi[0].y + dest_iter->roi[0].height;
+          const gint  dest_x1 = dest_iter->items[0].roi.x;
+          const gint  dest_y1 = dest_iter->items[0].roi.y;
+          const gint  dest_x2 = dest_iter->items[0].roi.x + dest_iter->items[0].roi.width;
+          const gint  dest_y2 = dest_iter->items[0].roi.y + dest_iter->items[0].roi.height;
           gint        x, y;
 
           for (y = dest_y1; y < dest_y2; y++)
@@ -276,7 +277,7 @@ gimp_gegl_convolve (GeglBuffer          *src_buffer,
                     }
                 }
 
-              dest += dest_iter->roi[0].width * dest_components;
+              dest += dest_iter->items[0].roi.width * dest_components;
             }
         }
     });
@@ -321,7 +322,7 @@ gimp_gegl_dodgeburn (GeglBuffer          *src_buffer,
 
       iter = gegl_buffer_iterator_new (src_buffer, src_area, 0,
                                        babl_format ("R'G'B'A float"),
-                                       GEGL_ACCESS_READ, GEGL_ABYSS_NONE);
+                                       GEGL_ACCESS_READ, GEGL_ABYSS_NONE, 2);
 
       gegl_buffer_iterator_add (iter, dest_buffer, dest_area, 0,
                                 babl_format ("R'G'B'A float"),
@@ -336,8 +337,8 @@ gimp_gegl_dodgeburn (GeglBuffer          *src_buffer,
 
           while (gegl_buffer_iterator_next (iter))
             {
-              gfloat *src   = (gfloat *) iter->data[0];
-              gfloat *dest  = (gfloat *) iter->data[1];
+              gfloat *src   = (gfloat *) iter->items[0].data;
+              gfloat *dest  = (gfloat *) iter->items[1].data;
               gint    count = iter->length;
 
               while (count--)
@@ -359,8 +360,8 @@ gimp_gegl_dodgeburn (GeglBuffer          *src_buffer,
 
           while (gegl_buffer_iterator_next (iter))
             {
-              gfloat *src   = (gfloat *) iter->data[0];
-              gfloat *dest  = (gfloat *) iter->data[1];
+              gfloat *src   = (gfloat *) iter->items[0].data;
+              gfloat *dest  = (gfloat *) iter->items[1].data;
               gint    count = iter->length;
 
               while (count--)
@@ -382,8 +383,8 @@ gimp_gegl_dodgeburn (GeglBuffer          *src_buffer,
 
           while (gegl_buffer_iterator_next (iter))
             {
-              gfloat *src   = (gfloat *) iter->data[0];
-              gfloat *dest  = (gfloat *) iter->data[1];
+              gfloat *src   = (gfloat *) iter->items[0].data;
+              gfloat *dest  = (gfloat *) iter->items[1].data;
               gint    count = iter->length;
 
               while (count--)
@@ -556,7 +557,7 @@ gimp_gegl_smudge_with_paint (GeglBuffer          *accum_buffer,
 
       iter = gegl_buffer_iterator_new (accum_buffer, accum_area, 0,
                                        babl_format ("RGBA float"),
-                                       GEGL_ACCESS_READWRITE, GEGL_ABYSS_NONE);
+                                       GEGL_ACCESS_READWRITE, GEGL_ABYSS_NONE, 3);
 
       gegl_buffer_iterator_add (iter, canvas_buffer, canvas_area, 0,
                                 babl_format ("RGBA float"),
@@ -572,9 +573,9 @@ gimp_gegl_smudge_with_paint (GeglBuffer          *accum_buffer,
 
       while (gegl_buffer_iterator_next (iter))
         {
-          gfloat       *accum  = (gfloat *)       iter->data[0];
-          const gfloat *canvas = (const gfloat *) iter->data[1];
-          gfloat       *paint  = (gfloat *)       iter->data[2];
+          gfloat       *accum  = (gfloat *)       iter->items[0].data;
+          const gfloat *canvas = (const gfloat *) iter->items[1].data;
+          gfloat       *paint  = (gfloat *)       iter->items[2].data;
           gint          count  = iter->length;
 
 #if COMPILE_SSE2_INTRINISICS
@@ -624,7 +625,7 @@ gimp_gegl_apply_mask (GeglBuffer          *mask_buffer,
 
       iter = gegl_buffer_iterator_new (mask_buffer, mask_area, 0,
                                        babl_format ("Y float"),
-                                       GEGL_ACCESS_READ, GEGL_ABYSS_NONE);
+                                       GEGL_ACCESS_READ, GEGL_ABYSS_NONE, 2);
 
       gegl_buffer_iterator_add (iter, dest_buffer, dest_area, 0,
                                 babl_format ("RGBA float"),
@@ -632,8 +633,8 @@ gimp_gegl_apply_mask (GeglBuffer          *mask_buffer,
 
       while (gegl_buffer_iterator_next (iter))
         {
-          const gfloat *mask  = (const gfloat *) iter->data[0];
-          gfloat       *dest  = (gfloat *)       iter->data[1];
+          const gfloat *mask  = (const gfloat *) iter->items[0].data;
+          gfloat       *dest  = (gfloat *)       iter->items[1].data;
           gint          count = iter->length;
 
           while (count--)
@@ -669,7 +670,7 @@ gimp_gegl_combine_mask (GeglBuffer          *mask_buffer,
 
       iter = gegl_buffer_iterator_new (mask_buffer, mask_area, 0,
                                        babl_format ("Y float"),
-                                       GEGL_ACCESS_READ, GEGL_ABYSS_NONE);
+                                       GEGL_ACCESS_READ, GEGL_ABYSS_NONE, 2);
 
       gegl_buffer_iterator_add (iter, dest_buffer, dest_area, 0,
                                 babl_format ("Y float"),
@@ -677,8 +678,8 @@ gimp_gegl_combine_mask (GeglBuffer          *mask_buffer,
 
       while (gegl_buffer_iterator_next (iter))
         {
-          const gfloat *mask  = (const gfloat *) iter->data[0];
-          gfloat       *dest  = (gfloat *)       iter->data[1];
+          const gfloat *mask  = (const gfloat *) iter->items[0].data;
+          gfloat       *dest  = (gfloat *)       iter->items[1].data;
           gint          count = iter->length;
 
           while (count--)
@@ -715,7 +716,7 @@ gimp_gegl_combine_mask_weird (GeglBuffer          *mask_buffer,
 
       iter = gegl_buffer_iterator_new (mask_buffer, mask_area, 0,
                                        babl_format ("Y float"),
-                                       GEGL_ACCESS_READ, GEGL_ABYSS_NONE);
+                                       GEGL_ACCESS_READ, GEGL_ABYSS_NONE, 2);
 
       gegl_buffer_iterator_add (iter, dest_buffer, dest_area, 0,
                                 babl_format ("Y float"),
@@ -723,8 +724,8 @@ gimp_gegl_combine_mask_weird (GeglBuffer          *mask_buffer,
 
       while (gegl_buffer_iterator_next (iter))
         {
-          const gfloat *mask  = (const gfloat *) iter->data[0];
-          gfloat       *dest  = (gfloat *)       iter->data[1];
+          const gfloat *mask  = (const gfloat *) iter->items[0].data;
+          gfloat       *dest  = (gfloat *)       iter->items[1].data;
           gint          count = iter->length;
 
           if (stipple)
@@ -787,7 +788,7 @@ gimp_gegl_replace (GeglBuffer          *top_buffer,
 
       iter = gegl_buffer_iterator_new (top_buffer, top_area, 0,
                                        babl_format ("RGBA float"),
-                                       GEGL_ACCESS_READ, GEGL_ABYSS_NONE);
+                                       GEGL_ACCESS_READ, GEGL_ABYSS_NONE, 4);
 
       gegl_buffer_iterator_add (iter, bottom_buffer, bottom_area, 0,
                                 babl_format ("RGBA float"),
@@ -803,10 +804,10 @@ gimp_gegl_replace (GeglBuffer          *top_buffer,
 
       while (gegl_buffer_iterator_next (iter))
         {
-          const gfloat *top    = (const gfloat *) iter->data[0];
-          const gfloat *bottom = (const gfloat *) iter->data[1];
-          const gfloat *mask   = (const gfloat *) iter->data[2];
-          gfloat       *dest   = (gfloat *)       iter->data[3];
+          const gfloat *top    = (const gfloat *) iter->items[0].data;
+          const gfloat *bottom = (const gfloat *) iter->items[1].data;
+          const gfloat *mask   = (const gfloat *) iter->items[2].data;
+          gfloat       *dest   = (gfloat *)       iter->items[3].data;
           gint          count  = iter->length;
 
           while (count--)
@@ -901,7 +902,7 @@ gimp_gegl_index_to_mask (GeglBuffer          *indexed_buffer,
 
       iter = gegl_buffer_iterator_new (indexed_buffer, indexed_area, 0,
                                        indexed_format,
-                                       GEGL_ACCESS_READ, GEGL_ABYSS_NONE);
+                                       GEGL_ACCESS_READ, GEGL_ABYSS_NONE, 2);
 
       gegl_buffer_iterator_add (iter, mask_buffer, mask_area, 0,
                                 babl_format ("Y float"),
@@ -909,8 +910,8 @@ gimp_gegl_index_to_mask (GeglBuffer          *indexed_buffer,
 
       while (gegl_buffer_iterator_next (iter))
         {
-          const guchar *indexed = (const guchar *) iter->data[0];
-          gfloat       *mask    = (gfloat *)       iter->data[1];
+          const guchar *indexed = (const guchar *) iter->items[0].data;
+          gfloat       *mask    = (gfloat *)       iter->items[1].data;
           gint          count   = iter->length;
 
           while (count--)
@@ -1050,11 +1051,11 @@ gimp_gegl_average_color (GeglBuffer          *buffer,
       gint                n        = 0;
 
       iter = gegl_buffer_iterator_new (buffer, area, 0, average_format,
-                                       GEGL_BUFFER_READ, abyss_policy);
+                                       GEGL_BUFFER_READ, abyss_policy, 1);
 
       while (gegl_buffer_iterator_next (iter))
         {
-          const gfloat *p = (const gfloat *) iter->data[0];
+          const gfloat *p = (const gfloat *) iter->items[0].data;
           gint          i;
 
           for (i = 0; i < iter->length; i++)


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