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



commit 2886f92bbd9fdbc805a928fda1831294199b4640
Author: Michael Natterer <mitch gimp org>
Date:   Tue May 13 21:48:40 2014 +0200

    Bug 730071 - Selection bounds miscalculated for multiples of 128
    
    gimp_channel_real_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/core/gimpchannel.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/app/core/gimpchannel.c b/app/core/gimpchannel.c
index 2d97f76..fa3792f 100644
--- a/app/core/gimpchannel.c
+++ b/app/core/gimpchannel.c
@@ -1121,14 +1121,19 @@ gimp_channel_real_bounds (GimpChannel *channel,
            */
           if (data[0] && data[maskPR.rowstride*(maskPR.h - 1) + maskPR.w - 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 (maskPR.x < tx1)
                 tx1 = maskPR.x;
               if (ex > tx2)
-                tx2 = ex;
+                tx2 = ex - 1;
               if (maskPR.y < ty1)
                 ty1 = maskPR.y;
               if (ey > ty2)
-                ty2 = ey;
+                ty2 = ey - 1;
             }
           else
             {


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