From: Robin Dunn Date: Tue, 29 Jul 2003 18:47:38 +0000 (+0000) Subject: Two fixes for CheckTransparency. First, don't start checking from X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/e45cc23511d0488774a00b1693aaa6881f37dfb6 Two fixes for CheckTransparency. First, don't start checking from (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 --- diff --git a/src/common/imagpng.cpp b/src/common/imagpng.cpp index 66e917422a..99db62ed93 100644 --- a/src/common/imagpng.cpp +++ b/src/common/imagpng.cpp @@ -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++ ) {