[gimp] app: Bug 667241 - Unable to paint after switching away from paint tool using fade tapering



commit 72fb271e007d505be0c954a8d4095c0a482fe23e
Author: Alexia Death <alexiadeath gmail com>
Date:   Mon Jan 9 22:54:05 2012 +0200

    app: Bug 667241 - Unable to paint after switching away from paint tool using fade tapering
    
    Make sure we up the pixel count when we bail in interpolate on 0-sized brush.

 app/paint/gimpbrushcore.c |   57 ++++++++++++++++++++++++--------------------
 1 files changed, 31 insertions(+), 26 deletions(-)
---
diff --git a/app/paint/gimpbrushcore.c b/app/paint/gimpbrushcore.c
index 7185a6a..8b19102 100644
--- a/app/paint/gimpbrushcore.c
+++ b/app/paint/gimpbrushcore.c
@@ -477,6 +477,33 @@ gimp_brush_core_interpolate (GimpPaintCore    *paint_core,
   gimp_paint_core_get_last_coords (paint_core, &last_coords);
   gimp_paint_core_get_current_coords (paint_core, &current_coords);
 
+  gimp_avoid_exact_integer (&last_coords.x);
+  gimp_avoid_exact_integer (&last_coords.y);
+  gimp_avoid_exact_integer (&current_coords.x);
+  gimp_avoid_exact_integer (&current_coords.y);
+
+  delta_vec.x    = current_coords.x        - last_coords.x;
+  delta_vec.y    = current_coords.y        - last_coords.y;
+  delta_pressure = current_coords.pressure - last_coords.pressure;
+  delta_xtilt    = current_coords.xtilt    - last_coords.xtilt;
+  delta_ytilt    = current_coords.ytilt    - last_coords.ytilt;
+  delta_wheel    = current_coords.wheel    - last_coords.wheel;
+  delta_velocity = current_coords.velocity - last_coords.velocity;
+  temp_direction = current_coords.direction;
+
+  /*  return if there has been no motion  */
+  if (! delta_vec.x    &&
+      ! delta_vec.y    &&
+      ! delta_pressure &&
+      ! delta_xtilt    &&
+      ! delta_ytilt    &&
+      ! delta_wheel    &&
+      ! delta_velocity)
+    return;
+
+  pixel_dist    = gimp_vector2_length (&delta_vec);
+  pixel_initial = paint_core->pixel_dist;
+
   /*  Zero sized brushes are unfit for interpolate, so we just let
    *  paint core fail on its own
    */
@@ -486,9 +513,13 @@ gimp_brush_core_interpolate (GimpPaintCore    *paint_core,
 
       gimp_paint_core_paint (paint_core, drawable, paint_options,
                              GIMP_PAINT_STATE_MOTION, time);
+
+      paint_core->pixel_dist = pixel_initial + pixel_dist; /* Dont forget to update pixel distance*/
+
       return;
     }
 
+  /* Handle dynamic spacing */
   spacing_output = gimp_dynamics_get_output (core->dynamics,
                                              GIMP_DYNAMICS_OUTPUT_SPACING);
 
@@ -517,30 +548,6 @@ gimp_brush_core_interpolate (GimpPaintCore    *paint_core,
       dyn_spacing = MAX (core->spacing, dyn_spacing);
     }
 
-  gimp_avoid_exact_integer (&last_coords.x);
-  gimp_avoid_exact_integer (&last_coords.y);
-  gimp_avoid_exact_integer (&current_coords.x);
-  gimp_avoid_exact_integer (&current_coords.y);
-
-  delta_vec.x    = current_coords.x        - last_coords.x;
-  delta_vec.y    = current_coords.y        - last_coords.y;
-  delta_pressure = current_coords.pressure - last_coords.pressure;
-  delta_xtilt    = current_coords.xtilt    - last_coords.xtilt;
-  delta_ytilt    = current_coords.ytilt    - last_coords.ytilt;
-  delta_wheel    = current_coords.wheel    - last_coords.wheel;
-  delta_velocity = current_coords.velocity - last_coords.velocity;
-  temp_direction = current_coords.direction;
-
-  /*  return if there has been no motion  */
-  if (! delta_vec.x    &&
-      ! delta_vec.y    &&
-      ! delta_pressure &&
-      ! delta_xtilt    &&
-      ! delta_ytilt    &&
-      ! delta_wheel    &&
-      ! delta_velocity)
-    return;
-
   /* calculate the distance traveled in the coordinate space of the brush */
   temp_vec = core->brush->x_axis;
   gimp_vector2_mul (&temp_vec, core->scale);
@@ -558,8 +565,6 @@ gimp_brush_core_interpolate (GimpPaintCore    *paint_core,
   total   = dist + paint_core->distance;
   initial = paint_core->distance;
 
-  pixel_dist    = gimp_vector2_length (&delta_vec);
-  pixel_initial = paint_core->pixel_dist;
 
   if (delta_vec.x * delta_vec.x > delta_vec.y * delta_vec.y)
     {



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