[gimp] app: Fix brush tools behavior at very small scale values



commit 20d77451fd2176f5e592f7eda5720876f2c951fb
Author: Alexia Death <alexiadeath gmail com>
Date:   Sun Mar 7 15:56:38 2010 +0200

    app: Fix brush tools behavior at very small scale values
    
    Tiny scale value now results in no stamp.

 app/core/gimpbrushgenerated.c |    8 ++++----
 app/paint/gimpbrushcore.c     |   22 +++++++++++++++++++++-
 2 files changed, 25 insertions(+), 5 deletions(-)
---
diff --git a/app/core/gimpbrushgenerated.c b/app/core/gimpbrushgenerated.c
index 639fc1e..98dee34 100644
--- a/app/core/gimpbrushgenerated.c
+++ b/app/core/gimpbrushgenerated.c
@@ -560,10 +560,10 @@ gimp_brush_generated_get_half_size (GimpBrushGenerated      *gbrush,
   GimpVector2  x_axis;
   GimpVector2  y_axis;
 
-  /* Since floatongpoint is not really accurate, 
-   * we need to round to limit the errors. 
-   * Errors in some border cases resulted in 
-   * different height and width reported for 
+  /* Since floatongpoint is not really accurate,
+   * we need to round to limit the errors.
+   * Errors in some border cases resulted in
+   * different height and width reported for
    * the same input value on calling procedure side.
    * This became problem at the rise of dynamics that
    * allows for any angle to turn up.
diff --git a/app/paint/gimpbrushcore.c b/app/paint/gimpbrushcore.c
index ca967c4..8fa4abe 100644
--- a/app/paint/gimpbrushcore.c
+++ b/app/paint/gimpbrushcore.c
@@ -331,6 +331,7 @@ gimp_brush_core_pre_paint (GimpPaintCore    *paint_core,
     {
       GimpCoords last_coords;
       GimpCoords current_coords;
+      gdouble scale;
 
       gimp_paint_core_get_last_coords (paint_core, &last_coords);
       gimp_paint_core_get_current_coords (paint_core, &current_coords);
@@ -348,6 +349,25 @@ gimp_brush_core_pre_paint (GimpPaintCore    *paint_core,
         {
           return FALSE;
         }
+  /*No drawing anything if the scale is too small*/
+  if (GIMP_BRUSH_CORE_GET_CLASS (core)->handles_transforming_brush)
+    {
+      GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
+      gdouble    fade_point;
+
+      if (GIMP_BRUSH_CORE_GET_CLASS (core)->handles_dynamic_transforming_brush)
+        {
+          fade_point = gimp_paint_options_get_fade (paint_options, image,
+                                                    paint_core->pixel_dist);
+
+          scale = paint_options->brush_scale *
+                  gimp_dynamics_output_get_linear_value (core->dynamics->size_output,
+                                                         &current_coords,
+                                                         paint_options,
+                                                         fade_point);
+          if (scale < 0.0001) return FALSE;
+        }
+    }
 
       if (GIMP_BRUSH_CORE_GET_CLASS (paint_core)->handles_changing_brush)
         {
@@ -1482,7 +1502,7 @@ gimp_brush_core_transform_mask (GimpBrushCore *core,
 
   if ((core->scale == 1.0) &&
       (core->angle == 0.0) &&
-      (core->hardness == 1.0) && 
+      (core->hardness == 1.0) &&
       (core->aspect_ratio == 1.0))
     return brush->mask;
 



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