[gimp] Bug 730071 - Selection bounds miscalculated for multiples of 128



commit 2acbf8a70fc8cec110b43b776cfb06a8254773fc
Author: Michael Natterer <mitch gimp org>
Date:   Tue May 13 21:41:17 2014 +0200

    Bug 730071 - Selection bounds miscalculated for multiples of 128
    
    gimp_gegl_mask_bounds(): when we succeed avoiding iterating a tile by
    checking its upper-left and bottom-right, use the function's internal
    meaning of x2, y2, which is the rightmost/bottommost selected pixel,
    while the external meaning is the pixel right/below it.
     Short: use "foo - 1" not "foo".

 app/gegl/gimp-gegl-mask.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/app/gegl/gimp-gegl-mask.c b/app/gegl/gimp-gegl-mask.c
index 20aede4..691537b 100644
--- a/app/gegl/gimp-gegl-mask.c
+++ b/app/gegl/gimp-gegl-mask.c
@@ -70,11 +70,16 @@ gimp_gegl_mask_bounds (GeglBuffer *buffer,
            */
           if (data[0] && data[iter->length - 1])
             {
+              /*  "ex/ey - 1" because the internal variables are the
+               *  right/bottom pixel of the mask's contents, not one
+               *  right/below it like the return values.
+               */
+
               if (roi->x < tx1) tx1 = roi->x;
-              if (ex > tx2)     tx2 = ex;
+              if (ex > tx2)     tx2 = ex - 1;
 
               if (roi->y < ty1) ty1 = roi->y;
-              if (ey > ty2)     ty2 = ey;
+              if (ey > ty2)     ty2 = ey - 1;
             }
           else
             {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]