[gimp] app: Fix garbage appearing in generated brushes with dynamic angles
- From: Alexia Death <alexiade src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gimp] app: Fix garbage appearing in generated brushes with dynamic angles
- Date: Wed, 30 Dec 2009 13:12:33 +0000 (UTC)
commit e79834b75ea9f47853fc0017195b2d8c7bce7fa6
Author: Alexia Death <alexiadeath gmail com>
Date: Wed Dec 30 15:10:34 2009 +0200
app: Fix garbage appearing in generated brushes with dynamic angles
Rounds angle used in generated brushes to avoid floating point precision problems.
app/core/gimpbrushgenerated.c | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/app/core/gimpbrushgenerated.c b/app/core/gimpbrushgenerated.c
index e18b096..3bde69b 100644
--- a/app/core/gimpbrushgenerated.c
+++ b/app/core/gimpbrushgenerated.c
@@ -558,6 +558,17 @@ 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
+ * the same input value on calling procedure side.
+ * This became problem at the rise of dynamics that
+ * allows for any angle to turn up.
+ **/
+
+ angle_in_degrees = ROUND (angle_in_degrees * 1000.0) / 1000.0;
+
s = sin (gimp_deg_to_rad (angle_in_degrees));
c = cos (gimp_deg_to_rad (angle_in_degrees));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]