X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2a8db3cddacf2c3fc244f109fdecbba3b0dfc386..e328812d748d2db49440a5fcf3ef9d3a49edbd56:/src/cocoa/bitmap.mm diff --git a/src/cocoa/bitmap.mm b/src/cocoa/bitmap.mm index 97d7712b1e..dd08e3387a 100644 --- a/src/cocoa/bitmap.mm +++ b/src/cocoa/bitmap.mm @@ -299,7 +299,8 @@ bool wxBitmap::Create(int w, int h, int d) hasAlpha: NO isPlanar: NO colorSpaceName: NSCalibratedRGBColorSpace - bytesPerRow: 0 + bytesPerRow: 0 // NOTE: Contrary to Apple documentation Mac OS + // 10.4 will add padding bytes when 0 is used here bitsPerPixel: 0]; wxLogTrace(wxTRACE_COCOA,wxT("M_BITMAPDATA=%p NSBitmapImageRep bitmapData=%p"), M_BITMAPDATA, [M_BITMAPDATA->m_cocoaNSBitmapImageRep bitmapData]); @@ -414,11 +415,11 @@ bool wxBitmap::CreateFromXpm(const char **xpm) #if wxUSE_IMAGE && wxUSE_XPM UnRef(); - wxCHECK_MSG( xpm, false, wxT("invalid XPM data") ) + wxCHECK_MSG( xpm, false, wxT("invalid XPM data") ); wxXPMDecoder decoder; wxImage img = decoder.ReadData(xpm); - wxCHECK_MSG( img.Ok(), false, wxT("invalid XPM data") ) + wxCHECK_MSG( img.Ok(), false, wxT("invalid XPM data") ); *this = wxBitmap(img); return true; @@ -447,9 +448,11 @@ bool wxBitmap::CreateFromImage(const wxImage& image, int depth) hasAlpha: NO isPlanar: NO colorSpaceName: NSCalibratedRGBColorSpace - bytesPerRow: 0 + bytesPerRow: image.GetWidth()*3 bitsPerPixel: 0]; + // TODO: Specify bytesPerRow:0 and then use [bitmapImage bytesPerRow] + // so that the rows are aligned suitably for altivec by the OS (Tiger) const int numBytes = image.GetWidth()*image.GetHeight()*3; memcpy([bitmapImage bitmapData], image.GetData(), numBytes); // TODO: Alpha and convert to desired depth