Fixed saving PNG in wrong format sometimes.
When explicitly requesting saving as a palettised image but then later on that turns out to not be possible (or desired) the image would be marked as PNG_COLOR_TYPE_GRAY or PNG_COLOR_TYPE_GRAY_ALPHA. Simply set the colour type to RGB if this occurs also updated the unit test to catch this case. This is similar to the fix in r66590 but that one was related to wxUSE_PALETTE == 0 cases. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66617 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -772,12 +772,16 @@ bool wxPNGHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbos
|
||||
}
|
||||
#else
|
||||
bool bUsePalette = false;
|
||||
#endif // wxUSE_PALETTE
|
||||
|
||||
if (iColorType == wxPNG_TYPE_PALETTE)
|
||||
/*
|
||||
If saving palettised was requested but it was decided we can't use a
|
||||
palette then reset the colour type to RGB.
|
||||
*/
|
||||
if (!bUsePalette && iColorType == wxPNG_TYPE_PALETTE)
|
||||
{
|
||||
iColorType = wxPNG_TYPE_COLOUR;
|
||||
}
|
||||
#endif // wxUSE_PALETTE
|
||||
|
||||
bool bUseAlpha = !bUsePalette && (bHasAlpha || bHasMask);
|
||||
|
||||
|
Reference in New Issue
Block a user