[gimp/gimp-2-10] app: add support for offset buffers in gimp_channel_select_buffer() ...



commit 901b0e72110bb9a87f570611c248b57c3f063004
Author: Ell <ell_se yahoo com>
Date:   Mon Feb 3 19:57:41 2020 +0200

    app: add support for offset buffers in gimp_channel_select_buffer() ...
    
    ... and gimp_gegl_mask_combine_buffer()
    
    Allow the functions to work with buffers whose top-left corner is
    not at (0, 0).
    
    (cherry picked from commit 24534338e7d941d8cd7ad52f6c161afaf8f22e9d)

 app/core/gimpchannel-combine.c     | 4 ++--
 app/gegl/gimp-gegl-mask-combine.cc | 3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/app/core/gimpchannel-combine.c b/app/core/gimpchannel-combine.c
index aaef7918c0..8326f65b0c 100644
--- a/app/core/gimpchannel-combine.c
+++ b/app/core/gimpchannel-combine.c
@@ -455,8 +455,8 @@ gimp_channel_combine_buffer (GimpChannel    *mask,
 
   if (gimp_channel_combine_start (mask, op,
                                   GEGL_RECTANGLE (
-                                    off_x,
-                                    off_y,
+                                    off_x + gegl_buffer_get_x (add_on_buffer),
+                                    off_y + gegl_buffer_get_y (add_on_buffer),
                                     gegl_buffer_get_width  (add_on_buffer),
                                     gegl_buffer_get_height (add_on_buffer)),
                                   FALSE, FALSE, &data))
diff --git a/app/gegl/gimp-gegl-mask-combine.cc b/app/gegl/gimp-gegl-mask-combine.cc
index 223c743712..0e61c0e282 100644
--- a/app/gegl/gimp-gegl-mask-combine.cc
+++ b/app/gegl/gimp-gegl-mask-combine.cc
@@ -516,7 +516,8 @@ gimp_gegl_mask_combine_buffer (GeglBuffer     *mask,
 
   if (! gegl_rectangle_intersect (&mask_rect,
                                   GEGL_RECTANGLE (
-                                    off_x, off_y,
+                                    off_x + gegl_buffer_get_x (add_on),
+                                    off_y + gegl_buffer_get_y (add_on),
                                     gegl_buffer_get_width  (add_on),
                                     gegl_buffer_get_height (add_on)),
                                   gegl_buffer_get_abyss (mask)))


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