[gimp/gimp-2-10] app: in gimp_drawable_apply_buffer(), work in chunks



commit 55569d512ee606b26d6489bd12a3162969f9a40d
Author: Ell <ell_se yahoo com>
Date:   Wed Mar 27 12:29:25 2019 -0400

    app: in gimp_drawable_apply_buffer(), work in chunks
    
    In gimp_drawable_real_apply_buffer(), use GimpChunkIterator to blit
    the applicator's output to the drawable's buffer in chunks, to
    minimize the space used for intermediate results.
    
    (cherry picked from commit 8f845d3a51ceb8a742bed0e83c893171ed506604)

 app/core/gimpdrawable-combine.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
---
diff --git a/app/core/gimpdrawable-combine.c b/app/core/gimpdrawable-combine.c
index 962fc9d2d9..e48d9dd6e0 100644
--- a/app/core/gimpdrawable-combine.c
+++ b/app/core/gimpdrawable-combine.c
@@ -17,6 +17,7 @@
 
 #include "config.h"
 
+#include <cairo.h>
 #include <gdk-pixbuf/gdk-pixbuf.h>
 #include <gegl.h>
 
@@ -28,6 +29,7 @@
 
 #include "gimp.h"
 #include "gimpchannel.h"
+#include "gimpchunkiterator.h"
 #include "gimpdrawable-combine.h"
 #include "gimpimage.h"
 
@@ -51,6 +53,7 @@ gimp_drawable_real_apply_buffer (GimpDrawable           *drawable,
   GimpImage         *image = gimp_item_get_image (item);
   GimpChannel       *mask  = gimp_image_get_mask (image);
   GimpApplicator    *applicator;
+  GimpChunkIterator *iter;
   gint               x, y, width, height;
   gint               offset_x, offset_y;
 
@@ -126,7 +129,16 @@ gimp_drawable_real_apply_buffer (GimpDrawable           *drawable,
   gimp_applicator_set_affect (applicator,
                               gimp_drawable_get_active_mask (drawable));
 
-  gimp_applicator_blit (applicator, GEGL_RECTANGLE (x, y, width, height));
+  iter = gimp_chunk_iterator_new (cairo_region_create_rectangle (
+    &(cairo_rectangle_int_t) {x, y, width, height}));
+
+  while (gimp_chunk_iterator_next (iter))
+    {
+      GeglRectangle rect;
+
+      while (gimp_chunk_iterator_get_rect (iter, &rect))
+        gimp_applicator_blit (applicator, &rect);
+    }
 
   g_object_unref (applicator);
 }


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