applying patch 1873285

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@52134 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2008-02-27 07:55:24 +00:00
parent 441be66059
commit 570da69887

View File

@@ -222,14 +222,16 @@ bool wxBitmapRefData::Create( int w , int h , int d )
m_width = wxMax(1, w);
m_height = wxMax(1, h);
m_depth = d ;
m_hBitmap = NULL ;
m_bytesPerRow = GetBestBytesPerRow( w * 4 ) ;
size_t size = m_bytesPerRow * h ;
void* data = m_memBuf.GetWriteBuf( size ) ;
if (data != NULL)
{
memset( data , 0 , size ) ;
m_memBuf.UngetWriteBuf( size ) ;
m_hBitmap = NULL ;
#if !wxMAC_USE_CORE_GRAPHICS
Rect rect = { 0 , 0 , m_height , m_width } ;
verify_noerr( NewGWorldFromPtr( (GWorldPtr*) &m_hBitmap , k32ARGBPixelFormat , &rect , NULL , NULL , 0 ,
@@ -241,6 +243,7 @@ bool wxBitmapRefData::Create( int w , int h , int d )
CGContextTranslateCTM( m_hBitmap, 0, m_height );
CGContextScaleCTM( m_hBitmap, 1, -1 );
#endif
} /* data != NULL */
m_ok = ( m_hBitmap != NULL ) ;
return m_ok ;
@@ -1047,8 +1050,12 @@ wxBitmap::~wxBitmap()
wxBitmap::wxBitmap(const char bits[], int the_width, int the_height, int no_bits)
{
m_refData = new wxBitmapRefData( the_width , the_height , no_bits ) ;
wxBitmapRefData* bitmapRefData;
m_refData = bitmapRefData = new wxBitmapRefData( the_width , the_height , no_bits ) ;
if (bitmapRefData->IsOk())
{
if ( no_bits == 1 )
{
int linesize = ( the_width / (sizeof(unsigned char) * 8)) ;
@@ -1092,6 +1099,7 @@ wxBitmap::wxBitmap(const char bits[], int the_width, int the_height, int no_bits
{
wxFAIL_MSG(wxT("multicolor BITMAPs not yet implemented"));
}
} /* bitmapRefData->IsOk() */
}
wxBitmap::wxBitmap(int w, int h, int d)
@@ -1281,8 +1289,12 @@ wxBitmap::wxBitmap(const wxImage& image, int depth)
int width = image.GetWidth();
int height = image.GetHeight();
m_refData = new wxBitmapRefData( width , height , depth ) ;
wxBitmapRefData* bitmapRefData;
m_refData = bitmapRefData = new wxBitmapRefData( width , height , depth ) ;
if (bitmapRefData->IsOk())
{
// Create picture
bool hasAlpha = false ;
@@ -1338,6 +1350,7 @@ wxBitmap::wxBitmap(const wxImage& image, int depth)
}
if ( image.HasMask() )
SetMask( new wxMask( *this , wxColour( image.GetMaskRed() , image.GetMaskGreen() , image.GetMaskBlue() ) ) ) ;
} /* bitmapRefData->IsOk() */
}
wxImage wxBitmap::ConvertToImage() const