[gimp] app: Fix ceil/floor amplifying errors in transform size calculation
- From: Alexia Death <alexiade src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: Fix ceil/floor amplifying errors in transform size calculation
- Date: Wed, 7 Apr 2010 21:31:51 +0000 (UTC)
commit 9ed712ddc460c6b1b6b6169933a3d513bef8bf76
Author: Alexia Death <alexiadeath gmail com>
Date: Thu Apr 8 00:29:09 2010 +0300
app: Fix ceil/floor amplifying errors in transform size calculation
app/core/gimpbrush-transform.c | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/app/core/gimpbrush-transform.c b/app/core/gimpbrush-transform.c
index d971f67..16a1726 100644
--- a/app/core/gimpbrush-transform.c
+++ b/app/core/gimpbrush-transform.c
@@ -682,21 +682,27 @@ gimp_brush_transform_bounding_box (TempBuf *brush,
const gdouble h = brush->height;
gdouble x1, x2, x3, x4;
gdouble y1, y2, y3, y4;
+ gdouble temp_x;
+ gdouble temp_y;
gimp_matrix3_transform_point (matrix, 0, 0, &x1, &y1);
gimp_matrix3_transform_point (matrix, w, 0, &x2, &y2);
gimp_matrix3_transform_point (matrix, 0, h, &x3, &y3);
gimp_matrix3_transform_point (matrix, w, h, &x4, &y4);
- *x = floor (MIN (MIN (x1, x2), MIN (x3, x4)));
- *y = floor (MIN (MIN (y1, y2), MIN (y3, y4)));
+ temp_x = MIN (MIN (x1, x2), MIN (x3, x4));
+ temp_y = MIN (MIN (y1, y2), MIN (y3, y4));
- *width = (gint) (ceil (MAX (MAX (x1, x2), MAX (x3, x4))) - *x);
- *height = (gint) (ceil (MAX (MAX (y1, y2), MAX (y3, y4))) - *y);
+ *width = (gint) ceil (MAX (MAX (x1, x2), MAX (x3, x4)) - temp_x);
+ *height = (gint) ceil (MAX (MAX (y1, y2), MAX (y3, y4)) - temp_y);
+
+ *x = floor (temp_x);
+ *y = floor (temp_y);
/* Transform size can not be less than 1 px */
*width = MAX(1, *width);
*height = MAX(1, *height);
+
}
static gdouble
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]