From e221b1ce84fa1f57d9588556dd188cdd0e89bb8e Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Fri, 25 Sep 2009 13:23:26 +0000 Subject: [PATCH] Applied #9140 (wxMac: Calculate size of bitmaps correctly when w or h is 0) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@62124 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/mac/carbon/bitmap.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/mac/carbon/bitmap.cpp b/src/mac/carbon/bitmap.cpp index 56b2bb8720..d1297e8754 100644 --- a/src/mac/carbon/bitmap.cpp +++ b/src/mac/carbon/bitmap.cpp @@ -224,8 +224,8 @@ bool wxBitmapRefData::Create( int w , int h , int d ) m_depth = d ; m_hBitmap = NULL ; - m_bytesPerRow = GetBestBytesPerRow( w * 4 ) ; - size_t size = m_bytesPerRow * h ; + m_bytesPerRow = GetBestBytesPerRow( m_width * 4 ) ; + size_t size = m_bytesPerRow * m_height ; void* data = m_memBuf.GetWriteBuf( size ) ; if (data != NULL) { @@ -675,13 +675,13 @@ PicHandle wxBitmapRefData::GetPictHandle() err = GraphicsExportDoExport(exporter, NULL); CGImageRelease( imageRef ); - size_t handleSize = GetHandleSize( (Handle) m_pictHandle ); - // the 512 bytes header is only needed for pict files, but not in memory - if ( handleSize >= 512 ) - { - memmove( *m_pictHandle , (char*)(*m_pictHandle)+512, handleSize - 512 ); - SetHandleSize( (Handle) m_pictHandle, handleSize - 512 ); - } + size_t handleSize = GetHandleSize( (Handle) m_pictHandle ); + // the 512 bytes header is only needed for pict files, but not in memory + if ( handleSize >= 512 ) + { + memmove( *m_pictHandle , (char*)(*m_pictHandle)+512, handleSize - 512 ); + SetHandleSize( (Handle) m_pictHandle, handleSize - 512 ); + } } CloseComponent( exporter ); }