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.

(cherry picked from commit c271992aa0)
This commit is contained in:
Ell
2018-10-27 00:07:22 -04:00
parent f46de793ae
commit 8a5ee944f7

View File

@ -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