]> git.saurik.com Git - wxWidgets.git/commitdiff
Always save PNG as a true colour image instead of possibly a palettised image when...
authorDimitri Schoolwerth <dimitri.schoolwerth@gmail.com>
Wed, 5 Jan 2011 11:39:44 +0000 (11:39 +0000)
committerDimitri Schoolwerth <dimitri.schoolwerth@gmail.com>
Wed, 5 Jan 2011 11:39:44 +0000 (11:39 +0000)
With wxUSE_PALETTE set to 0 and the user forcing to want a wxPNG_TYPE_PALETTE format the image would (partially) be marked as PNG_COLOR_TYPE_GRAY or PNG_COLOR_TYPE_GRAY_ALPHA instead and also saving would fail later on. Instead detect this specific case and save in the wxPNG_TYPE_COLOUR format.

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

src/common/imagpng.cpp

index 70e2a0abac679ce7f6c3e1f5e682fb93bbf782bb..f2f625c40e017167b7ba6c45c83710d4d1e9fa28 100644 (file)
@@ -772,6 +772,11 @@ bool wxPNGHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbos
     }
 #else
     bool bUsePalette = false;
+
+    if (iColorType == wxPNG_TYPE_PALETTE)
+    {
+        iColorType = wxPNG_TYPE_COLOUR;
+    }
 #endif // wxUSE_PALETTE
 
     bool bUseAlpha = !bUsePalette && (bHasAlpha || bHasMask);