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
This commit is contained in:
Dimitri Schoolwerth
2011-01-05 11:39:44 +00:00
parent 5d875c119e
commit 13c5d825d3

View 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);