[gimp] Issue #2386 - Pattern fill with selection is shifted in 2.10



commit 38dcb73bfcfbdd1e308d3477ee2b68f0561bfaaf
Author: Michael Natterer <mitch gimp org>
Date:   Mon Oct 22 16:39:19 2018 +0200

    Issue #2386 - Pattern fill with selection is shifted in 2.10
    
    Add pattern offset parameters to gimp_fill_options_create_buffer() and
    pass the selection's top-left corner so that pattern fills on the same
    drawable are aligned.

 app/core/gimpdrawable-bucket-fill.c | 3 ++-
 app/core/gimpdrawable-edit.c        | 3 ++-
 app/core/gimpdrawable-fill.c        | 3 ++-
 app/core/gimpfilloptions.c          | 8 ++++++--
 app/core/gimpfilloptions.h          | 4 +++-
 5 files changed, 15 insertions(+), 6 deletions(-)
---
diff --git a/app/core/gimpdrawable-bucket-fill.c b/app/core/gimpdrawable-bucket-fill.c
index 6969e88d1b..a1a181eeb9 100644
--- a/app/core/gimpdrawable-bucket-fill.c
+++ b/app/core/gimpdrawable-bucket-fill.c
@@ -167,7 +167,8 @@ gimp_drawable_bucket_fill (GimpDrawable         *drawable,
 
   buffer = gimp_fill_options_create_buffer (options, drawable,
                                             GEGL_RECTANGLE (0, 0,
-                                                            width, height));
+                                                            width, height),
+                                            -x, -y);
 
   gimp_gegl_apply_opacity (buffer, NULL, NULL, buffer,
                            mask_buffer,
diff --git a/app/core/gimpdrawable-edit.c b/app/core/gimpdrawable-edit.c
index c8a888545a..0cc3f45d67 100644
--- a/app/core/gimpdrawable-edit.c
+++ b/app/core/gimpdrawable-edit.c
@@ -75,7 +75,8 @@ gimp_drawable_edit_fill (GimpDrawable    *drawable,
 
   buffer = gimp_fill_options_create_buffer (options, drawable,
                                             GEGL_RECTANGLE (0, 0,
-                                                            width, height));
+                                                            width, height),
+                                            -x, -y);
 
   if (! undo_desc)
     undo_desc = gimp_fill_options_get_undo_desc (options);
diff --git a/app/core/gimpdrawable-fill.c b/app/core/gimpdrawable-fill.c
index 5adaeeff7b..dfe8dd9405 100644
--- a/app/core/gimpdrawable-fill.c
+++ b/app/core/gimpdrawable-fill.c
@@ -249,7 +249,8 @@ gimp_drawable_fill_scan_convert (GimpDrawable    *drawable,
                             gimp_fill_options_get_antialias (options));
 
   buffer = gimp_fill_options_create_buffer (options, drawable,
-                                            GEGL_RECTANGLE (0, 0, w, h));
+                                            GEGL_RECTANGLE (0, 0, w, h),
+                                            -x, -y);
 
   gimp_gegl_apply_opacity (buffer, NULL, NULL, buffer,
                            mask_buffer, 0, 0, 1.0);
diff --git a/app/core/gimpfilloptions.c b/app/core/gimpfilloptions.c
index 3da41e94d4..fb42509da0 100644
--- a/app/core/gimpfilloptions.c
+++ b/app/core/gimpfilloptions.c
@@ -407,7 +407,9 @@ gimp_fill_options_get_undo_desc (GimpFillOptions *options)
 GeglBuffer *
 gimp_fill_options_create_buffer (GimpFillOptions     *options,
                                  GimpDrawable        *drawable,
-                                 const GeglRectangle *rect)
+                                 const GeglRectangle *rect,
+                                 gint                 pattern_offset_x,
+                                 gint                 pattern_offset_y)
 {
   GeglBuffer  *buffer;
 
@@ -443,7 +445,9 @@ gimp_fill_options_create_buffer (GimpFillOptions     *options,
         pattern = gimp_context_get_pattern (GIMP_CONTEXT (options));
 
         gimp_drawable_fill_buffer (drawable, buffer,
-                                   NULL, pattern, 0, 0);
+                                   NULL, pattern,
+                                   pattern_offset_x,
+                                   pattern_offset_y);
       }
       break;
     }
diff --git a/app/core/gimpfilloptions.h b/app/core/gimpfilloptions.h
index 200abe4bd7..f4277c5466 100644
--- a/app/core/gimpfilloptions.h
+++ b/app/core/gimpfilloptions.h
@@ -73,7 +73,9 @@ const gchar     * gimp_fill_options_get_undo_desc    (GimpFillOptions     *optio
 
 GeglBuffer      * gimp_fill_options_create_buffer    (GimpFillOptions     *options,
                                                       GimpDrawable        *drawable,
-                                                      const GeglRectangle *rect);
+                                                      const GeglRectangle *rect,
+                                                      gint                 pattern_offset_x,
+                                                      gint                 pattern_offset_y);
 
 
 #endif /* __GIMP_FILL_OPTIONS_H__ */


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