[gimp/gimp-2-10] Issue #3723 - Symmetry Painting with random colour isn't symmetrical



commit 965756b17fe425be695e95c38ceb45cb1bef9b09
Author: Ell <ell_se yahoo com>
Date:   Fri Aug 2 22:25:00 2019 +0300

    Issue #3723 - Symmetry Painting with random colour isn't symmetrical
    
    In GimpPaintbrush, calculate grad_point in
    _gimp_paintbrush_motion() independently of any stroke, and pass
    its value down to GimpPaintbrush::get_paint_params() at each
    stroke, so that the color is the same for all strokes, even when
    using a color/random dynamics.
    
    (cherry picked from commit 95429ad704b328584ddbf8fa0b65a242698fa8eb)

 app/paint/gimperaser.c     |  2 ++
 app/paint/gimppaintbrush.c | 31 ++++++++++++++-----------------
 app/paint/gimppaintbrush.h |  1 +
 3 files changed, 17 insertions(+), 17 deletions(-)
---
diff --git a/app/paint/gimperaser.c b/app/paint/gimperaser.c
index a8d72d1dae..68a535e50f 100644
--- a/app/paint/gimperaser.c
+++ b/app/paint/gimperaser.c
@@ -46,6 +46,7 @@ static void       gimp_eraser_get_paint_params        (GimpPaintbrush
                                                        GimpDrawable              *drawable,
                                                        GimpPaintOptions          *paint_options,
                                                        GimpSymmetry              *sym,
+                                                       gdouble                    grad_point,
                                                        GimpLayerMode             *paint_mode,
                                                        GimpPaintApplicationMode  *paint_appl_mode,
                                                        const GimpTempBuf        **paint_pixmap,
@@ -107,6 +108,7 @@ gimp_eraser_get_paint_params (GimpPaintbrush            *paintbrush,
                               GimpDrawable              *drawable,
                               GimpPaintOptions          *paint_options,
                               GimpSymmetry              *sym,
+                              gdouble                    grad_point,
                               GimpLayerMode             *paint_mode,
                               GimpPaintApplicationMode  *paint_appl_mode,
                               const GimpTempBuf        **paint_pixmap,
diff --git a/app/paint/gimppaintbrush.c b/app/paint/gimppaintbrush.c
index a4bbf387b4..2afd13cfec 100644
--- a/app/paint/gimppaintbrush.c
+++ b/app/paint/gimppaintbrush.c
@@ -61,6 +61,7 @@ static void       gimp_paintbrush_real_get_paint_params        (GimpPaintbrush
                                                                 GimpDrawable              *drawable,
                                                                 GimpPaintOptions          *paint_options,
                                                                 GimpSymmetry              *sym,
+                                                                gdouble                    grad_point,
                                                                 GimpLayerMode             *paint_mode,
                                                                 GimpPaintApplicationMode  *paint_appl_mode,
                                                                 const GimpTempBuf        **paint_pixmap,
@@ -179,28 +180,16 @@ gimp_paintbrush_real_get_paint_params (GimpPaintbrush            *paintbrush,
                                        GimpDrawable              *drawable,
                                        GimpPaintOptions          *paint_options,
                                        GimpSymmetry              *sym,
+                                       gdouble                    grad_point,
                                        GimpLayerMode             *paint_mode,
                                        GimpPaintApplicationMode  *paint_appl_mode,
                                        const GimpTempBuf        **paint_pixmap,
                                        GimpRGB                   *paint_color)
 {
-  GimpPaintCore    *paint_core = GIMP_PAINT_CORE (paintbrush);
-  GimpBrushCore    *brush_core = GIMP_BRUSH_CORE (paintbrush);
-  GimpContext      *context    = GIMP_CONTEXT (paint_options);
-  GimpDynamics     *dynamics   = brush_core->dynamics;
-  GimpImage        *image      = gimp_item_get_image (GIMP_ITEM (drawable));
-  const GimpCoords *coords     = gimp_symmetry_get_origin (sym);
-  gdouble           fade_point;
-  gdouble           grad_point;
-
-  fade_point = gimp_paint_options_get_fade (paint_options, image,
-                                            paint_core->pixel_dist);
-
-  grad_point = gimp_dynamics_get_linear_value (dynamics,
-                                               GIMP_DYNAMICS_OUTPUT_COLOR,
-                                               coords,
-                                               paint_options,
-                                               fade_point);
+  GimpPaintCore *paint_core = GIMP_PAINT_CORE (paintbrush);
+  GimpBrushCore *brush_core = GIMP_BRUSH_CORE (paintbrush);
+  GimpContext   *context    = GIMP_CONTEXT (paint_options);
+  GimpImage     *image      = gimp_item_get_image (GIMP_ITEM (drawable));
 
   *paint_mode = gimp_context_get_paint_mode (context);
 
@@ -247,6 +236,7 @@ _gimp_paintbrush_motion (GimpPaintCore    *paint_core,
   GimpDynamics     *dynamics   = brush_core->dynamics;
   GimpImage        *image      = gimp_item_get_image (GIMP_ITEM (drawable));
   gdouble           fade_point;
+  gdouble           grad_point;
   gdouble           force;
   const GimpCoords *coords;
   gint              n_strokes;
@@ -273,6 +263,12 @@ _gimp_paintbrush_motion (GimpPaintCore    *paint_core,
                                                coords);
     }
 
+  grad_point = gimp_dynamics_get_linear_value (dynamics,
+                                               GIMP_DYNAMICS_OUTPUT_COLOR,
+                                               coords,
+                                               paint_options,
+                                               fade_point);
+
   n_strokes = gimp_symmetry_get_size (sym);
   for (i = 0; i < n_strokes; i++)
     {
@@ -291,6 +287,7 @@ _gimp_paintbrush_motion (GimpPaintCore    *paint_core,
                                                                 drawable,
                                                                 paint_options,
                                                                 sym,
+                                                                grad_point,
                                                                 &paint_mode,
                                                                 &paint_appl_mode,
                                                                 &paint_pixmap,
diff --git a/app/paint/gimppaintbrush.h b/app/paint/gimppaintbrush.h
index 75ca7adf48..61f8d851ee 100644
--- a/app/paint/gimppaintbrush.h
+++ b/app/paint/gimppaintbrush.h
@@ -54,6 +54,7 @@ struct _GimpPaintbrushClass
                                           GimpDrawable              *drawable,
                                           GimpPaintOptions          *paint_options,
                                           GimpSymmetry              *sym,
+                                          gdouble                    grad_point,
                                           GimpLayerMode             *paint_mode,
                                           GimpPaintApplicationMode  *paint_appl_mode,
                                           const GimpTempBuf        **paint_pixmap,


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