[gimp/gimp-2-10] Issue #2405 - Rotation center shifts by half a pixel ...



commit 8a5ee944f74a0cb2ac37511ce97fe951a9f055f1
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.
    
    (cherry picked from commit c271992aa01dc8d565524ade8f511f4932c307fd)

 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]