[gegl] workshop: migrate ops to new iterator api



commit 96e601a6a3a7382bbbb5f4e11319aa61c3e97867
Author: Øyvind Kolås <pippin gimp org>
Date:   Tue Sep 11 02:41:28 2018 +0200

    workshop: migrate ops to new iterator api

 operations/workshop/enlarge.c        |  1 +
 operations/workshop/inpaint.c        |  1 +
 operations/workshop/pixel-duster.h   | 14 +++++++-------
 operations/workshop/segment-kmeans.c | 13 +++++++------
 4 files changed, 16 insertions(+), 13 deletions(-)
---
diff --git a/operations/workshop/enlarge.c b/operations/workshop/enlarge.c
index f9cb587c8..b4379571b 100644
--- a/operations/workshop/enlarge.c
+++ b/operations/workshop/enlarge.c
@@ -17,6 +17,7 @@
  *
  */
 
+#define GEGL_ITERATOR2_API
 #include <stdio.h>
 #include "config.h"
 #include <glib/gi18n-lib.h>
diff --git a/operations/workshop/inpaint.c b/operations/workshop/inpaint.c
index 26a860665..f4086c93c 100644
--- a/operations/workshop/inpaint.c
+++ b/operations/workshop/inpaint.c
@@ -17,6 +17,7 @@
  *
  */
 
+#define GEGL_ITERATOR2_API
 #include <stdio.h>
 #include "config.h"
 #include <glib/gi18n-lib.h>
diff --git a/operations/workshop/pixel-duster.h b/operations/workshop/pixel-duster.h
index 60708b4af..da8f82850 100644
--- a/operations/workshop/pixel-duster.h
+++ b/operations/workshop/pixel-duster.h
@@ -734,13 +734,13 @@ static inline void pixel_duster_add_probes_for_transparent (PixelDuster *duster)
                                                     0,
                                                     format,
                                                     GEGL_ACCESS_WRITE,
-                                                    GEGL_ABYSS_NONE);
+                                                    GEGL_ABYSS_NONE, 1);
   while (gegl_buffer_iterator_next (i))
   {
-    gint x = i->roi[0].x;
-    gint y = i->roi[0].y;
-    gint n_pixels  = i->roi[0].width * i->roi[0].height;
-    float *out_pix = i->data[0];
+    gint x = i->items[0].roi.x;
+    gint y = i->items[0].roi.y;
+    gint n_pixels  = i->items[0].roi.width * i->items[0].roi.height;
+    float *out_pix = i->items[0].data;
     while (n_pixels--)
     {
       if (out_pix[3] <= 0.001 ||
@@ -753,9 +753,9 @@ static inline void pixel_duster_add_probes_for_transparent (PixelDuster *duster)
       out_pix += 4;
 
       x++;
-      if (x >= i->roi[0].x + i->roi[0].width)
+      if (x >= i->items[0].roi.x + i->items[0].roi.width)
       {
-        x = i->roi[0].x;
+        x = i->items[0].roi.x;
         y++;
       }
     }
diff --git a/operations/workshop/segment-kmeans.c b/operations/workshop/segment-kmeans.c
index 474a89a3e..adfa507ce 100644
--- a/operations/workshop/segment-kmeans.c
+++ b/operations/workshop/segment-kmeans.c
@@ -19,6 +19,7 @@
  *
  */
 
+#define GEGL_ITERATOR2_API
 #include "config.h"
 #include <glib/gi18n-lib.h>
 
@@ -177,11 +178,11 @@ assign_pixels_to_clusters (GeglBuffer *input,
   GeglBufferIterator *iter;
 
   iter = gegl_buffer_iterator_new (input, NULL, 0, babl_format ("CIE Lab float"),
-                                   GEGL_ACCESS_READ, GEGL_ABYSS_NONE);
+                                   GEGL_ACCESS_READ, GEGL_ABYSS_NONE, 1);
 
   while (gegl_buffer_iterator_next (iter))
     {
-      gfloat *pixel = iter->data[0];
+      gfloat *pixel = iter->items[0].data;
       glong   n_pixels = iter->length;
 
       while (n_pixels--)
@@ -242,15 +243,15 @@ set_output (GeglBuffer *input,
   GeglBufferIterator *iter;
 
   iter = gegl_buffer_iterator_new (output, NULL, 0, babl_format ("CIE Lab float"),
-                                   GEGL_ACCESS_WRITE, GEGL_ABYSS_NONE);
+                                   GEGL_ACCESS_WRITE, GEGL_ABYSS_NONE, 2);
 
   gegl_buffer_iterator_add (iter, input, NULL, 0, babl_format ("CIE Lab float"),
                             GEGL_ACCESS_READ, GEGL_ABYSS_NONE);
 
   while (gegl_buffer_iterator_next (iter))
     {
-      gfloat *out_pixel = iter->data[0];
-      gfloat *in_pixel  = iter->data[1];
+      gfloat *out_pixel = iter->items[0].data;
+      gfloat *in_pixel  = iter->items[1].data;
       glong   n_pixels = iter->length;
 
       while (n_pixels--)
@@ -395,4 +396,4 @@ gegl_op_class_init (GeglOpClass *klass)
       NULL);
 }
 
-#endif
\ No newline at end of file
+#endif


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