[gimp] app: Fix heal tool behavior at top and left edge (Bug 568098)



commit 2d34092f48fc73e38a28c79d72a0d8ff9552f397
Author: Michael Henning <mikehenning eclipse net>
Date:   Mon May 7 18:57:57 2012 -0400

    app: Fix heal tool behavior at top and left edge (Bug 568098)
    
    Fixes calculation of the mask buffer's rectangle.

 app/paint/gimpheal.c |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)
---
diff --git a/app/paint/gimpheal.c b/app/paint/gimpheal.c
index 5381d76..1235461 100644
--- a/app/paint/gimpheal.c
+++ b/app/paint/gimpheal.c
@@ -483,6 +483,8 @@ gimp_heal_motion (GimpSourceCore   *source_core,
   const GimpTempBuf *mask_buf;
   gdouble            fade_point;
   gdouble            hardness;
+  gint               mask_off_x;
+  gint               mask_off_y;
 
   fade_point = gimp_paint_options_get_fade (paint_options, image,
                                             paint_core->pixel_dist);
@@ -534,6 +536,15 @@ gimp_heal_motion (GimpSourceCore   *source_core,
 
   mask_buffer = gimp_temp_buf_create_buffer ((GimpTempBuf *) mask_buf);
 
+  /* find the offset of the brush mask's rect */
+  {
+    gint x = (gint) floor (coords->x) - (gegl_buffer_get_width  (mask_buffer) >> 1);
+    gint y = (gint) floor (coords->y) - (gegl_buffer_get_height (mask_buffer) >> 1);
+
+    mask_off_x = (x < 0) ? -x : 0;
+    mask_off_y = (y < 0) ? -y : 0;
+  }
+
   gimp_heal (src_copy,
              GEGL_RECTANGLE (0, 0,
                              gegl_buffer_get_width  (src_copy),
@@ -544,9 +555,9 @@ gimp_heal_motion (GimpSourceCore   *source_core,
                              paint_area_width,
                              paint_area_height),
              mask_buffer,
-             GEGL_RECTANGLE (0, 0,
-                             gegl_buffer_get_width  (mask_buffer),
-                             gegl_buffer_get_height (mask_buffer)));
+             GEGL_RECTANGLE (mask_off_x, mask_off_y,
+                             paint_area_width,
+                             paint_area_height));
 
   g_object_unref (src_copy);
   g_object_unref (mask_buffer);



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