From: Dimitri Schoolwerth Date: Wed, 5 Jan 2011 11:39:44 +0000 (+0000) Subject: Always save PNG as a true colour image instead of possibly a palettised image when... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/13c5d825d390faf0f8806c5e24e05461add6fa4e Always save PNG as a true colour image instead of possibly a palettised image when wxUSE_PALETTE is set to 0. 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 --- diff --git a/src/common/imagpng.cpp b/src/common/imagpng.cpp index 70e2a0abac..f2f625c40e 100644 --- a/src/common/imagpng.cpp +++ b/src/common/imagpng.cpp @@ -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);