From e854ed477efa1efdb17d2c9ae74d11b2c5e111e9 Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Wed, 8 Dec 2004 22:29:25 +0000 Subject: [PATCH] Applied patch for PNG8 alpha mask. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30908 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/imagpng.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/common/imagpng.cpp b/src/common/imagpng.cpp index 54c3ac8819..7370823ed9 100644 --- a/src/common/imagpng.cpp +++ b/src/common/imagpng.cpp @@ -287,7 +287,7 @@ FindMaskColour(unsigned char **lines, png_uint_32 width, png_uint_32 height, } } - if ( !h.FindFirstUnusedColour(&rMask, &gMask, &bMask) ) + if ( !h.FindFirstUnusedColour(&rMask, &gMask, &bMask, rMask, gMask, bMask) ) { wxLogWarning(_("Too many colours in PNG, the image may be slightly blurred.")); @@ -435,8 +435,14 @@ void CopyDataFromPNG(wxImage *image, if ( transparency == Transparency_Mask ) { - FindMaskColour(lines, width, height, - rMask, gMask, bMask); + if ( IsTransparent( a ) && ( ! ( rMask || gMask || bMask ) ) ) + { + rMask = r; + gMask = g; + bMask = b; + + FindMaskColour(lines, width, height, rMask, gMask, bMask ); + } } else // transparency == Transparency_Alpha { -- 2.45.2