X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1e6feb95a79834836e88143b15d9f424ebe79621..124193837f27d1fb75b9607f0e005b9897d1e320:/src/common/quantize.cpp?ds=sidebyside diff --git a/src/common/quantize.cpp b/src/common/quantize.cpp index f6e1fb45ba..07c63c52e2 100644 --- a/src/common/quantize.cpp +++ b/src/common/quantize.cpp @@ -1483,8 +1483,11 @@ void wxQuantize::DoQuantize(unsigned w, unsigned h, unsigned char **in_rows, uns // TODO: somehow make use of the Windows system colours, rather than ignoring them for the // purposes of quantization. -bool wxQuantize::Quantize(const wxImage& src, wxImage& dest, wxPalette** pPalette, int desiredNoColours, - unsigned char** eightBitData, int flags) +bool wxQuantize::Quantize(const wxImage& src, wxImage& dest, + wxPalette** pPalette, + int desiredNoColours, + unsigned char** eightBitData, + int flags) { int i; @@ -1559,6 +1562,7 @@ bool wxQuantize::Quantize(const wxImage& src, wxImage& dest, wxPalette** pPalett else delete[] data8bit; +#if wxUSE_PALETTE // Make a wxWindows palette if (pPalette) { @@ -1604,6 +1608,7 @@ bool wxQuantize::Quantize(const wxImage& src, wxImage& dest, wxPalette** pPalett delete[] g; delete[] b; } +#endif // wxUSE_PALETTE return TRUE; } @@ -1611,20 +1616,24 @@ bool wxQuantize::Quantize(const wxImage& src, wxImage& dest, wxPalette** pPalett // This version sets a palette in the destination image so you don't // have to manage it yourself. -bool wxQuantize::Quantize(const wxImage& src, wxImage& dest, int desiredNoColours, - unsigned char** eightBitData, int flags) +bool wxQuantize::Quantize(const wxImage& src, + wxImage& dest, + int desiredNoColours, + unsigned char** eightBitData, + int flags) { wxPalette* palette = NULL; - if (Quantize(src, dest, & palette, desiredNoColours, eightBitData, flags)) + if ( !Quantize(src, dest, & palette, desiredNoColours, eightBitData, flags) ) + return FALSE; + +#if wxUSE_PALETTE + if (palette) { - if (palette) - { - dest.SetPalette(* palette); - delete palette; - } - return TRUE; + dest.SetPalette(* palette); + delete palette; } - else - return FALSE; +#endif // wxUSE_PALETTE + + return TRUE; }