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/branches/WX_3_0_BRANCH@78354 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2015-01-06 20:08:25 +00:00
parent 440e477ea7
commit c489816251
2 changed files with 3 additions and 4 deletions

View File

@@ -603,6 +603,7 @@ wxMSW:
wxOSX:
- Fix conversion of wxBitmap to wxImage in 64 bit builds.
- Fix wxFileDialog::GetFilterIndex() for file open dialogs (phsilva).

View File

@@ -1422,13 +1422,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) ;
@@ -1470,7 +1469,6 @@ wxImage wxBitmap::ConvertToImage() const
data[index + 2] = b ;
index += 3;
source += 4 ;
}
}