Update transparency flag for wxBitmap created from wxIcon
Just created wxBitmap has "hasAlpha" flag set to false so it needs to be modified if source wxIcon contains transparency values. Closes #17953.
This commit is contained in:
@@ -834,20 +834,22 @@ wxBitmapRefData::~wxBitmapRefData()
|
||||
|
||||
bool wxBitmap::CopyFromIcon(const wxIcon& icon)
|
||||
{
|
||||
bool created = false ;
|
||||
int w = icon.GetWidth() ;
|
||||
int h = icon.GetHeight() ;
|
||||
|
||||
Create( w , h ) ;
|
||||
if ( !created )
|
||||
if ( Create( w, h ) )
|
||||
{
|
||||
wxMemoryDC dc ;
|
||||
dc.SelectObject( *this ) ;
|
||||
dc.DrawIcon( icon , 0 , 0 ) ;
|
||||
dc.SelectObject( wxNullBitmap ) ;
|
||||
|
||||
// Assume 32 bpp icon has transparency values
|
||||
UseAlpha(icon.GetDepth() == 32);
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
wxBitmap::wxBitmap(const char bits[], int the_width, int the_height, int no_bits)
|
||||
|
Reference in New Issue
Block a user