X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1c193821a999730fbf6a9bea83763f37daae68f1..0f314c30b8c4ffbd7d87146f72be7a061d506235:/src/common/quantize.cpp diff --git a/src/common/quantize.cpp b/src/common/quantize.cpp index 3b2f3dc9a1..55fe0fc032 100644 --- a/src/common/quantize.cpp +++ b/src/common/quantize.cpp @@ -30,7 +30,7 @@ /* modified by Vaclav Slavik for use as jpeglib-independent module */ -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #pragma implementation "quantize.h" #endif @@ -45,11 +45,12 @@ #include "wx/palette.h" #endif +#if wxUSE_IMAGE + #include "wx/image.h" #include "wx/quantize.h" #ifdef __WXMSW__ -#include #include "wx/msw/private.h" #endif @@ -1301,7 +1302,6 @@ start_pass_2_quant (j_decompress_ptr cinfo, bool is_pre_scan) { my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; hist3d histogram = cquantize->histogram; - int i; if (is_pre_scan) { /* Set up method pointers */ @@ -1313,9 +1313,6 @@ start_pass_2_quant (j_decompress_ptr cinfo, bool is_pre_scan) cquantize->pub.color_quantize = pass2_fs_dither; cquantize->pub.finish_pass = finish_pass2; - /* Make sure color count is acceptable */ - i = cinfo->actual_number_of_colors; - { size_t arraysize = (size_t) ((cinfo->output_width + 2) * (3 * sizeof(FSERROR))); @@ -1333,7 +1330,7 @@ start_pass_2_quant (j_decompress_ptr cinfo, bool is_pre_scan) } /* Zero the histogram or inverse color map, if necessary */ if (cquantize->needs_zeroed) { - for (i = 0; i < HIST_C0_ELEMS; i++) { + for (int i = 0; i < HIST_C0_ELEMS; i++) { memset((void *) histogram[i], 0, HIST_C1_ELEMS*HIST_C2_ELEMS * sizeof(histcell)); } @@ -1509,8 +1506,6 @@ bool wxQuantize::Quantize(const wxImage& src, wxImage& dest, { int i; - int w = src.GetWidth(); - int h = src.GetHeight(); int windowsSystemColourCount = 20; @@ -1528,8 +1523,9 @@ bool wxQuantize::Quantize(const wxImage& src, wxImage& dest, #endif // create rows info: + int h = src.GetHeight(); + int w = src.GetWidth(); unsigned char **rows = new unsigned char *[h]; - h = src.GetHeight(), w = src.GetWidth(); unsigned char *imgdt = src.GetData(); for (i = 0; i < h; i++) rows[i] = imgdt + 3/*RGB*/ * w * i; @@ -1656,3 +1652,6 @@ bool wxQuantize::Quantize(const wxImage& src, return TRUE; } +#endif + // wxUSE_IMAGE +