[gimp] Issue #2405 - Rotation center shifts by half a pixel ...
- From: Ell <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Issue #2405 - Rotation center shifts by half a pixel ...
- Date: Sat, 27 Oct 2018 04:16:05 +0000 (UTC)
commit c271992aa01dc8d565524ade8f511f4932c307fd
Author: Ell <ell_se yahoo com>
Date: Sat Oct 27 00:07:22 2018 -0400
Issue #2405 - Rotation center shifts by half a pixel ...
... the second time you do a 180 degrees rotation
In gimp_transform_resize_adjust(), nudge the transformed layer
boundary by EPSILON toward the center, to avoid enlarging the layer
unnecessarily, as a result of numeric error amplified by rounding,
when the tranformed boundary should land on integer coordinates.
In particular, this avoids enlarging the layer when rotating by 180
degrees.
app/core/gimp-transform-resize.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/app/core/gimp-transform-resize.c b/app/core/gimp-transform-resize.c
index 059a3413e1..50e44d6f4a 100644
--- a/app/core/gimp-transform-resize.c
+++ b/app/core/gimp-transform-resize.c
@@ -233,11 +233,11 @@ gimp_transform_resize_adjust (const GimpVector2 *points,
bottom_right.y = MAX (bottom_right.y, points[i].y);
}
- *x1 = (gint) floor (top_left.x);
- *y1 = (gint) floor (top_left.y);
+ *x1 = (gint) floor (top_left.x + EPSILON);
+ *y1 = (gint) floor (top_left.y + EPSILON);
- *x2 = (gint) ceil (bottom_right.x);
- *y2 = (gint) ceil (bottom_right.y);
+ *x2 = (gint) ceil (bottom_right.x - EPSILON);
+ *y2 = (gint) ceil (bottom_right.y - EPSILON);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]