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
This commit is contained in:
@@ -224,8 +224,8 @@ bool wxBitmapRefData::Create( int w , int h , int d )
|
|||||||
m_depth = d ;
|
m_depth = d ;
|
||||||
m_hBitmap = NULL ;
|
m_hBitmap = NULL ;
|
||||||
|
|
||||||
m_bytesPerRow = GetBestBytesPerRow( w * 4 ) ;
|
m_bytesPerRow = GetBestBytesPerRow( m_width * 4 ) ;
|
||||||
size_t size = m_bytesPerRow * h ;
|
size_t size = m_bytesPerRow * m_height ;
|
||||||
void* data = m_memBuf.GetWriteBuf( size ) ;
|
void* data = m_memBuf.GetWriteBuf( size ) ;
|
||||||
if (data != NULL)
|
if (data != NULL)
|
||||||
{
|
{
|
||||||
@@ -675,13 +675,13 @@ PicHandle wxBitmapRefData::GetPictHandle()
|
|||||||
err = GraphicsExportDoExport(exporter, NULL);
|
err = GraphicsExportDoExport(exporter, NULL);
|
||||||
CGImageRelease( imageRef );
|
CGImageRelease( imageRef );
|
||||||
|
|
||||||
size_t handleSize = GetHandleSize( (Handle) m_pictHandle );
|
size_t handleSize = GetHandleSize( (Handle) m_pictHandle );
|
||||||
// the 512 bytes header is only needed for pict files, but not in memory
|
// the 512 bytes header is only needed for pict files, but not in memory
|
||||||
if ( handleSize >= 512 )
|
if ( handleSize >= 512 )
|
||||||
{
|
{
|
||||||
memmove( *m_pictHandle , (char*)(*m_pictHandle)+512, handleSize - 512 );
|
memmove( *m_pictHandle , (char*)(*m_pictHandle)+512, handleSize - 512 );
|
||||||
SetHandleSize( (Handle) m_pictHandle, handleSize - 512 );
|
SetHandleSize( (Handle) m_pictHandle, handleSize - 512 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CloseComponent( exporter );
|
CloseComponent( exporter );
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user