[gimp] app: Aspect ratio fixes



commit 4816a61dcb7dcec59853315471a6131c1f71d833
Author: Alexia Death <alexiadeath gmail com>
Date:   Mon May 10 00:11:55 2010 +0300

    app: Aspect ratio fixes

 app/core/gimpbrushgenerated.c |    4 ++--
 app/paint/gimpbrushcore.c     |   11 +++++++++++
 2 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/app/core/gimpbrushgenerated.c b/app/core/gimpbrushgenerated.c
index 98dee34..eb7aec6 100644
--- a/app/core/gimpbrushgenerated.c
+++ b/app/core/gimpbrushgenerated.c
@@ -316,7 +316,7 @@ gimp_brush_generated_transform_size (GimpBrush *gbrush,
                                       brush->radius * scale,
                                       brush->spikes,
                                       brush->hardness,
-                                      brush->aspect_ratio * aspect_ratio,
+                                      MIN (brush->aspect_ratio * aspect_ratio, 20),
                                       (brush->angle + 360 * angle),
                                       &half_width, &half_height,
                                       NULL, NULL, NULL, NULL);
@@ -335,7 +335,7 @@ gimp_brush_generated_transform_mask (GimpBrush *gbrush,
   GimpBrushGenerated *brush  = GIMP_BRUSH_GENERATED (gbrush);
 
   /* Since generated brushes are symmetric the dont have intput
-   * for aspect ratios  < 1.0. its same as rotate by 90 degrees and
+   * for aspect ratios  < 1.0. its same as rotate by extra 90 degrees and
    * 1 / ratio. So we fix the input up for this case.   */
 
   if (aspect_ratio < 1.0)
diff --git a/app/paint/gimpbrushcore.c b/app/paint/gimpbrushcore.c
index 25273ad..9d6c2f1 100644
--- a/app/paint/gimpbrushcore.c
+++ b/app/paint/gimpbrushcore.c
@@ -32,6 +32,7 @@
 #include "paint-funcs/paint-funcs.h"
 
 #include "core/gimpbrush.h"
+#include "core/gimpbrushgenerated.h"
 #include "core/gimpdrawable.h"
 #include "core/gimpdynamics.h"
 #include "core/gimpdynamicsoutput.h"
@@ -42,8 +43,11 @@
 
 #include "gimpbrushcore.h"
 #include "gimpbrushcore-kernels.h"
+
+
 #include "gimppaintoptions.h"
 
+
 #include "gimp-intl.h"
 
 
@@ -1021,6 +1025,13 @@ gimp_brush_core_transform_bound_segs (GimpBrushCore    *core,
   angle = core->angle;
   aspect_ratio = core->aspect_ratio;
 
+  /* Generated brushes have their aspect ratio appled before base angle */
+  if (aspect_ratio != 1.0 && GIMP_IS_BRUSH_GENERATED (core->main_brush))
+    {
+      gdouble base_angle = gimp_brush_generated_get_angle (
+                                       GIMP_BRUSH_GENERATED (core->main_brush));
+      angle = angle + base_angle / 360;
+    }
   height = core->brush_bound_width;
   width  = core->brush_bound_height;
 



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