Compilation fix for PNG saving code when wxUSE_PALETTE==0.

Don't handle wxPNG_TYPE_PALETTE and don't compile PaletteFind() in at all when
wxUSE_PALETTE is off.

Closes #12505.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66577 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2011-01-04 15:10:09 +00:00
parent 264b16122e
commit 967956ddcf

View File

@@ -649,8 +649,9 @@ error:
// SaveFile() helpers // SaveFile() helpers
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
static int PaletteFind(const png_color& clr, #if wxUSE_PALETTE
const png_color *pal, int palCount)
static int PaletteFind(const png_color& clr, const png_color *pal, int palCount)
{ {
for (int i = 0; i < palCount; ++i) for (int i = 0; i < palCount; ++i)
{ {
@@ -665,6 +666,8 @@ static int PaletteFind(const png_color& clr,
return wxNOT_FOUND; return wxNOT_FOUND;
} }
#endif // wxUSE_PALETTE
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// writing PNGs // writing PNGs
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -1004,10 +1007,12 @@ bool wxPNGHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbos
*pData++ = 0; *pData++ = 0;
break; break;
#if wxUSE_PALETTE
case wxPNG_TYPE_PALETTE: case wxPNG_TYPE_PALETTE:
*pData++ = (unsigned char) PaletteFind(clr, *pData++ = (unsigned char) PaletteFind(clr,
palette, numPalette); palette, numPalette);
break; break;
#endif // wxUSE_PALETTE
} }
if ( bUseAlpha ) if ( bUseAlpha )