X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9731a5fe6ccb208437afb3fe6e27e32100e09d78..25db1b74f1264c27bbf2e5fcc9f3a19ccc56d5fc:/src/common/image.cpp diff --git a/src/common/image.cpp b/src/common/image.cpp index 5086141878..fe48bf366a 100644 --- a/src/common/image.cpp +++ b/src/common/image.cpp @@ -58,7 +58,9 @@ public: unsigned char m_maskRed,m_maskGreen,m_maskBlue; bool m_ok; bool m_static; +#if wxUSE_PALETTE wxPalette m_palette; +#endif // wxUSE_PALETTE wxArrayString m_optionNames; wxArrayString m_optionValues; }; @@ -235,6 +237,9 @@ wxImage wxImage::Scale( int width, int height ) const char unsigned *source_data = M_IMGDATA->m_data; char unsigned *target_data = data; +#if 0 + // This is nonsense, RR. + // We do (x, y) -> (x, y)*oldSize/newSize but the valid values of x and y // are from 0 to size-1, hence all decrement the sizes long old_old_width = old_width; @@ -255,6 +260,20 @@ wxImage wxImage::Scale( int width, int height ) const target_data += 3; } } +#else + for (long j = 0; j < height; j++) + { + long y_offset = (j * old_height / height) * old_width; + + for (long i = 0; i < width; i++) + { + memcpy( target_data, + source_data + 3*(y_offset + ((i * old_width )/ width)), + 3 ); + target_data += 3; + } + } +#endif return image; } @@ -701,6 +720,8 @@ int wxImage::GetHeight() const return M_IMGDATA->m_height; } +#if wxUSE_PALETTE + // Palette functions bool wxImage::HasPalette() const @@ -725,6 +746,8 @@ void wxImage::SetPalette(const wxPalette& palette) M_IMGDATA->m_palette = palette; } +#endif // wxUSE_PALETTE + // Option functions (arbitrary name/value mapping) void wxImage::SetOption(const wxString& name, const wxString& value) { @@ -1160,7 +1183,7 @@ unsigned long wxImage::CountColours( unsigned long stopafter ) wxHashTable h; wxObject dummy; unsigned char r, g, b; - unsigned char *p; + unsigned char *p; unsigned long size, nentries, key; p = GetData(); @@ -1195,7 +1218,7 @@ unsigned long wxImage::CountColours( unsigned long stopafter ) unsigned long wxImage::ComputeHistogram( wxHashTable &h ) { unsigned char r, g, b; - unsigned char *p; + unsigned char *p; unsigned long size, nentries, key; wxHNode *hnode;