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
This commit is contained in:
@@ -1418,13 +1418,12 @@ wxImage wxBitmap::ConvertToImage() const
|
|||||||
for (int yy = 0; yy < height; yy++ , sourcestart += M_BITMAPDATA->GetBytesPerRow() , mask += maskBytesPerRow )
|
for (int yy = 0; yy < height; yy++ , sourcestart += M_BITMAPDATA->GetBytesPerRow() , mask += maskBytesPerRow )
|
||||||
{
|
{
|
||||||
unsigned char * maskp = mask ;
|
unsigned char * maskp = mask ;
|
||||||
unsigned char * source = sourcestart;
|
const wxUint32 * source = (wxUint32*)sourcestart;
|
||||||
unsigned char a, r, g, b;
|
unsigned char a, r, g, b;
|
||||||
long color;
|
|
||||||
|
|
||||||
for (int xx = 0; xx < width; xx++)
|
for (int xx = 0; xx < width; xx++)
|
||||||
{
|
{
|
||||||
color = *((long*) source) ;
|
const wxUint32 color = *source++;
|
||||||
#ifdef WORDS_BIGENDIAN
|
#ifdef WORDS_BIGENDIAN
|
||||||
a = ((color&0xFF000000) >> 24) ;
|
a = ((color&0xFF000000) >> 24) ;
|
||||||
r = ((color&0x00FF0000) >> 16) ;
|
r = ((color&0x00FF0000) >> 16) ;
|
||||||
@@ -1466,7 +1465,6 @@ wxImage wxBitmap::ConvertToImage() const
|
|||||||
data[index + 2] = b ;
|
data[index + 2] = b ;
|
||||||
|
|
||||||
index += 3;
|
index += 3;
|
||||||
source += 4 ;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user