]> git.saurik.com Git - wxWidgets.git/commitdiff
Compilation fix for PNG saving code when wxUSE_PALETTE==0.
authorVadim Zeitlin <vadim@wxwidgets.org>
Tue, 4 Jan 2011 15:10:09 +0000 (15:10 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Tue, 4 Jan 2011 15:10:09 +0000 (15:10 +0000)
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

src/common/imagpng.cpp

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