From ee5ab1fffa3a1bee134acac47800c2de3ae9ba3b Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 6 Jan 2015 20:20:19 +0000 Subject: [PATCH] Fix wxBitmap conversion to wxImage in 64-bit wxOSX builds. Don't assume that sizeof(long) == 4, this is just wrong. Closes #16770. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78355 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/osx/core/bitmap.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/osx/core/bitmap.cpp b/src/osx/core/bitmap.cpp index 351973219f..ce38f9eb01 100644 --- a/src/osx/core/bitmap.cpp +++ b/src/osx/core/bitmap.cpp @@ -1418,13 +1418,12 @@ wxImage wxBitmap::ConvertToImage() const for (int yy = 0; yy < height; yy++ , sourcestart += M_BITMAPDATA->GetBytesPerRow() , mask += maskBytesPerRow ) { unsigned char * maskp = mask ; - unsigned char * source = sourcestart; + const wxUint32 * source = (wxUint32*)sourcestart; unsigned char a, r, g, b; - long color; for (int xx = 0; xx < width; xx++) { - color = *((long*) source) ; + const wxUint32 color = *source++; #ifdef WORDS_BIGENDIAN a = ((color&0xFF000000) >> 24) ; r = ((color&0x00FF0000) >> 16) ; @@ -1466,7 +1465,6 @@ wxImage wxBitmap::ConvertToImage() const data[index + 2] = b ; index += 3; - source += 4 ; } }