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
This commit is contained in:
@@ -220,14 +220,13 @@ CheckTransparency(unsigned char **lines,
|
|||||||
png_uint_32 x, png_uint_32 y, png_uint_32 w, png_uint_32 h,
|
png_uint_32 x, png_uint_32 y, png_uint_32 w, png_uint_32 h,
|
||||||
size_t numColBytes)
|
size_t numColBytes)
|
||||||
{
|
{
|
||||||
// we start from (x + 1, y)
|
|
||||||
x++;
|
|
||||||
|
|
||||||
// suppose that a mask will suffice and check all the remaining alpha
|
// suppose that a mask will suffice and check all the remaining alpha
|
||||||
// values to see if it does
|
// values to see if it does
|
||||||
for ( ; y < h; y++ )
|
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++ )
|
for ( png_uint_32 x2 = x; x2 < w; x2++ )
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user