[gimp/gimp-2-10] Issue #266 - Healing Tool - Sample Merged option does not work



commit a94b1389ed8c9615717824e65c6b0f7f40e67fcb
Author: Michael Natterer <mitch gimp org>
Date:   Sat Jan 19 18:29:04 2019 +0100

    Issue #266 - Healing Tool - Sample Merged option does not work
    
    gimp_heal_motion(): when sample merged is active, simply initialize
    the paint buffer from the projection instead of the drawable.
    
    (cherry picked from commit e269a837cd4a7f86bdfec593742a79f705acda59)

 app/paint/gimpheal.c | 33 +++++++++++++++++++++++++++------
 1 file changed, 27 insertions(+), 6 deletions(-)
---
diff --git a/app/paint/gimpheal.c b/app/paint/gimpheal.c
index ca1282fc01..bc0f5c09d2 100644
--- a/app/paint/gimpheal.c
+++ b/app/paint/gimpheal.c
@@ -511,17 +511,21 @@ gimp_heal_motion (GimpSourceCore   *source_core,
                   gint              paint_area_width,
                   gint              paint_area_height)
 {
-  GimpPaintCore     *paint_core = GIMP_PAINT_CORE (source_core);
-  GimpContext       *context    = GIMP_CONTEXT (paint_options);
-  GimpDynamics      *dynamics   = GIMP_BRUSH_CORE (paint_core)->dynamics;
-  GimpImage         *image      = gimp_item_get_image (GIMP_ITEM (drawable));
+  GimpPaintCore     *paint_core  = GIMP_PAINT_CORE (source_core);
+  GimpContext       *context     = GIMP_CONTEXT (paint_options);
+  GimpSourceOptions *src_options = GIMP_SOURCE_OPTIONS (paint_options);
+  GimpDynamics      *dynamics    = GIMP_BRUSH_CORE (paint_core)->dynamics;
+  GimpImage         *image       = gimp_item_get_image (GIMP_ITEM (drawable));
   GeglBuffer        *src_copy;
   GeglBuffer        *mask_buffer;
+  GimpPickable      *dest_pickable;
   const GimpTempBuf *mask_buf;
   gdouble            fade_point;
   gdouble            force;
   gint               mask_off_x;
   gint               mask_off_y;
+  gint               dest_pickable_off_x;
+  gint               dest_pickable_off_y;
 
   fade_point = gimp_paint_options_get_fade (paint_options, image,
                                             paint_core->pixel_dist);
@@ -566,8 +570,25 @@ gimp_heal_motion (GimpSourceCore   *source_core,
                                          src_rect->width,
                                          src_rect->height));
 
-  gimp_gegl_buffer_copy (gimp_drawable_get_buffer (drawable),
-                         GEGL_RECTANGLE (paint_buffer_x, paint_buffer_y,
+  if (src_options->sample_merged)
+    {
+      dest_pickable = GIMP_PICKABLE (image);
+
+      gimp_item_get_offset (GIMP_ITEM (drawable),
+                            &dest_pickable_off_x,
+                            &dest_pickable_off_y);
+    }
+  else
+    {
+      dest_pickable = GIMP_PICKABLE (drawable);
+
+      dest_pickable_off_x = 0;
+      dest_pickable_off_y = 0;
+    }
+
+  gimp_gegl_buffer_copy (gimp_pickable_get_buffer (dest_pickable),
+                         GEGL_RECTANGLE (paint_buffer_x + dest_pickable_off_x,
+                                         paint_buffer_y + dest_pickable_off_y,
                                          gegl_buffer_get_width  (paint_buffer),
                                          gegl_buffer_get_height (paint_buffer)),
                          GEGL_ABYSS_NONE,


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