]> git.saurik.com Git - wxWidgets.git/commitdiff
Two fixes for CheckTransparency. First, don't start checking from
authorRobin Dunn <robin@alldunn.com>
Tue, 29 Jul 2003 18:47:38 +0000 (18:47 +0000)
committerRobin Dunn <robin@alldunn.com>
Tue, 29 Jul 2003 18:47:38 +0000 (18:47 +0000)
(x+1,y) since you don't know if (x,y) is transparent or not.  Second,
use x*(numColBytes+1) instead of just x to offset into the first
line.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@22368 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/imagpng.cpp

index 66e917422ac619472ba14fdff90bba0a21471017..99db62ed93b5d66045e1a9479f7475e3652eef75 100644 (file)
@@ -220,14 +220,13 @@ CheckTransparency(unsigned char **lines,
                   png_uint_32 x, png_uint_32 y, png_uint_32 w, png_uint_32 h,
                   size_t numColBytes)
 {
-    // we start from (x + 1, y)
-    x++;
-
     // suppose that a mask will suffice and check all the remaining alpha
     // values to see if it does
     for ( ; y < h; y++ )
     {
-        unsigned const char *ptr = lines[y] + x;
+        // each pixel is numColBytes+1 bytes, offset into the current line by
+        // the current x position
+        unsigned const char *ptr = lines[y] + (x * (numColBytes + 1));
 
         for ( png_uint_32 x2 = x; x2 < w; x2++ )
         {