]> git.saurik.com Git - wxWidgets.git/commitdiff
Applied patch for PNG8 alpha mask.
authorRobert Roebling <robert@roebling.de>
Wed, 8 Dec 2004 22:29:25 +0000 (22:29 +0000)
committerRobert Roebling <robert@roebling.de>
Wed, 8 Dec 2004 22:29:25 +0000 (22:29 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30908 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/imagpng.cpp

index 54c3ac8819c0a61afbf4de00cb55aefb6baf18b6..7370823ed95347a87644f09143174163d490aa67 100644 (file)
@@ -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
                     {