X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/6721fc3852ff183e0a59c990cf62ae595c036d05..9cf99fc093f9c45b6b5d8d8b357699d826c9916a:/src/common/image.cpp?ds=sidebyside diff --git a/src/common/image.cpp b/src/common/image.cpp index a9b0a152e4..51318de205 100644 --- a/src/common/image.cpp +++ b/src/common/image.cpp @@ -235,6 +235,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 +258,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; } @@ -1040,7 +1057,7 @@ wxImageHandler *wxImage::FindHandlerMime( const wxString& mimetype ) void wxImage::InitStandardHandlers() { AddHandler(new wxBMPHandler); -#if !defined(__WXGTK__) && !defined(__WXMOTIF__) +#if wxUSE_XPM && !defined(__WXGTK__) && !defined(__WXMOTIF__) AddHandler(new wxXPMHandler); #endif } @@ -1160,7 +1177,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 +1212,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;