[gimp/gimp-2-10] app: image-convert-indexed migrated to new buffer iterator



commit 244ddef844eafc2d380ab828e073c9363eff51f8
Author: Øyvind Kolås <pippin gimp org>
Date:   Tue Sep 11 00:18:36 2018 +0200

    app: image-convert-indexed migrated to new buffer iterator
    
    (cherry picked from commit 9f481d3607a02da1a1be069f10bf081d8571f6b8)

 app/core/gimpimage-convert-indexed.c | 55 ++++++++++++++++++------------------
 1 file changed, 28 insertions(+), 27 deletions(-)
---
diff --git a/app/core/gimpimage-convert-indexed.c b/app/core/gimpimage-convert-indexed.c
index 1bca247cd4..216b02d9e5 100644
--- a/app/core/gimpimage-convert-indexed.c
+++ b/app/core/gimpimage-convert-indexed.c
@@ -136,6 +136,7 @@
 
 #include <cairo.h>
 #include <gdk-pixbuf/gdk-pixbuf.h>
+#define GEGL_ITERATOR2_API
 #include <gegl.h>
 
 #include "libgimpcolor/gimpcolor.h"
@@ -699,11 +700,11 @@ remap_indexed_layer (GimpLayer    *layer,
 
   iter = gegl_buffer_iterator_new (gimp_drawable_get_buffer (GIMP_DRAWABLE (layer)),
                                    NULL, 0, NULL,
-                                   GEGL_ACCESS_READWRITE, GEGL_ABYSS_NONE);
+                                   GEGL_ACCESS_READWRITE, GEGL_ABYSS_NONE, 1);
 
   while (gegl_buffer_iterator_next (iter))
     {
-      guchar *data   = iter->data[0];
+      guchar *data   = iter->items[0].data;
       gint    length = iter->length;
 
       if (has_alpha)
@@ -1129,11 +1130,11 @@ generate_histogram_gray (CFHistogram  histogram,
 
   iter = gegl_buffer_iterator_new (gimp_drawable_get_buffer (GIMP_DRAWABLE (layer)),
                                    NULL, 0, format,
-                                   GEGL_ACCESS_READ, GEGL_ABYSS_NONE);
+                                   GEGL_ACCESS_READ, GEGL_ABYSS_NONE, 1);
 
   while (gegl_buffer_iterator_next (iter))
     {
-      const guchar *data   = iter->data[0];
+      const guchar *data   = iter->items[0].data;
       gint          length = iter->length;
 
       if (has_alpha)
@@ -1196,15 +1197,15 @@ generate_histogram_rgb (CFHistogram   histogram,
 
   iter = gegl_buffer_iterator_new (gimp_drawable_get_buffer (GIMP_DRAWABLE (layer)),
                                    NULL, 0, format,
-                                   GEGL_ACCESS_READ, GEGL_ABYSS_NONE);
-  roi = &iter->roi[0];
+                                   GEGL_ACCESS_READ, GEGL_ABYSS_NONE, 1);
+  roi = &iter->items[0].roi;
 
   if (progress)
     gimp_progress_set_value (progress, 0.0);
 
   while (gegl_buffer_iterator_next (iter))
     {
-      const guchar *data   = iter->data[0];
+      const guchar *data   = iter->items[0].data;
       gint          length = iter->length;
 
       total_size += length;
@@ -2850,8 +2851,8 @@ median_cut_pass2_no_dither_gray (QuantizeObj *quantobj,
 
   iter = gegl_buffer_iterator_new (gimp_drawable_get_buffer (GIMP_DRAWABLE (layer)),
                                    NULL, 0, NULL,
-                                   GEGL_ACCESS_READ, GEGL_ABYSS_NONE);
-  src_roi = &iter->roi[0];
+                                   GEGL_ACCESS_READ, GEGL_ABYSS_NONE, 2);
+  src_roi = &iter->items[0].roi;
 
   gegl_buffer_iterator_add (iter, new_buffer,
                             NULL, 0, NULL,
@@ -2859,8 +2860,8 @@ median_cut_pass2_no_dither_gray (QuantizeObj *quantobj,
 
   while (gegl_buffer_iterator_next (iter))
     {
-      const guchar *src  = iter->data[0];
-      guchar       *dest = iter->data[1];
+      const guchar *src  = iter->items[0].data;
+      guchar       *dest = iter->items[1].data;
       gint          row;
 
       for (row = 0; row < src_roi->height; row++)
@@ -2956,8 +2957,8 @@ median_cut_pass2_fixed_dither_gray (QuantizeObj *quantobj,
 
   iter = gegl_buffer_iterator_new (gimp_drawable_get_buffer (GIMP_DRAWABLE (layer)),
                                    NULL, 0, NULL,
-                                   GEGL_ACCESS_READ, GEGL_ABYSS_NONE);
-  src_roi = &iter->roi[0];
+                                   GEGL_ACCESS_READ, GEGL_ABYSS_NONE, 2);
+  src_roi = &iter->items[0].roi;
 
   gegl_buffer_iterator_add (iter, new_buffer,
                             NULL, 0, NULL,
@@ -2965,8 +2966,8 @@ median_cut_pass2_fixed_dither_gray (QuantizeObj *quantobj,
 
   while (gegl_buffer_iterator_next (iter))
     {
-      const guchar *src  = iter->data[0];
-      guchar       *dest = iter->data[1];
+      const guchar *src  = iter->items[0].data;
+      guchar       *dest = iter->items[1].data;
       gint          row;
 
       for (row = 0; row < src_roi->height; row++)
@@ -3135,8 +3136,8 @@ median_cut_pass2_no_dither_rgb (QuantizeObj *quantobj,
 
   iter = gegl_buffer_iterator_new (gimp_drawable_get_buffer (GIMP_DRAWABLE (layer)),
                                    NULL, 0, NULL,
-                                   GEGL_ACCESS_READ, GEGL_ABYSS_NONE);
-  src_roi = &iter->roi[0];
+                                   GEGL_ACCESS_READ, GEGL_ABYSS_NONE, 2);
+  src_roi = &iter->items[0].roi;
 
   gegl_buffer_iterator_add (iter, new_buffer,
                             NULL, 0, NULL,
@@ -3147,8 +3148,8 @@ median_cut_pass2_no_dither_rgb (QuantizeObj *quantobj,
 
   while (gegl_buffer_iterator_next (iter))
     {
-      const guchar *src  = iter->data[0];
-      guchar       *dest = iter->data[1];
+      const guchar *src  = iter->items[0].data;
+      guchar       *dest = iter->items[1].data;
       gint          row;
 
       total_size += src_roi->height * src_roi->width;
@@ -3268,8 +3269,8 @@ median_cut_pass2_fixed_dither_rgb (QuantizeObj *quantobj,
 
   iter = gegl_buffer_iterator_new (gimp_drawable_get_buffer (GIMP_DRAWABLE (layer)),
                                    NULL, 0, NULL,
-                                   GEGL_ACCESS_READ, GEGL_ABYSS_NONE);
-  src_roi = &iter->roi[0];
+                                   GEGL_ACCESS_READ, GEGL_ABYSS_NONE, 2);
+  src_roi = &iter->items[0].roi;
 
   gegl_buffer_iterator_add (iter, new_buffer,
                             NULL, 0, NULL,
@@ -3280,8 +3281,8 @@ median_cut_pass2_fixed_dither_rgb (QuantizeObj *quantobj,
 
   while (gegl_buffer_iterator_next (iter))
     {
-      const guchar *src  = iter->data[0];
-      guchar       *dest = iter->data[1];
+      const guchar *src  = iter->items[0].data;
+      guchar       *dest = iter->items[1].data;
       gint          row;
 
       total_size += src_roi->height * src_roi->width;
@@ -3482,8 +3483,8 @@ median_cut_pass2_nodestruct_dither_rgb (QuantizeObj *quantobj,
 
   iter = gegl_buffer_iterator_new (gimp_drawable_get_buffer (GIMP_DRAWABLE (layer)),
                                    NULL, 0, NULL,
-                                   GEGL_ACCESS_READ, GEGL_ABYSS_NONE);
-  src_roi = &iter->roi[0];
+                                   GEGL_ACCESS_READ, GEGL_ABYSS_NONE, 2);
+  src_roi = &iter->items[0].roi;
 
   gegl_buffer_iterator_add (iter, new_buffer,
                             NULL, 0, NULL,
@@ -3491,8 +3492,8 @@ median_cut_pass2_nodestruct_dither_rgb (QuantizeObj *quantobj,
 
   while (gegl_buffer_iterator_next (iter))
     {
-      const guchar *src  = iter->data[0];
-      guchar       *dest = iter->data[1];
+      const guchar *src  = iter->items[0].data;
+      guchar       *dest = iter->items[1].data;
       gint          row;
 
       for (row = 0; row < src_roi->height; row++)


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