supporting 24 and 64 sizes via scaling up

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67170 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2011-03-11 19:54:44 +00:00
parent 8383e673b1
commit e9020f0b22

View File

@@ -440,8 +440,21 @@ void wxIcon::CopyFromBitmap( const wxBitmap& bmp )
UnRef() ;
// as the bitmap owns that ref, we have to acquire it as well
IconRef iconRef = bmp.CreateIconRef() ;
m_refData = new wxIconRefData( (WXHICON) iconRef, bmp.GetWidth(), bmp.GetHeight() ) ;
int w = bmp.GetWidth() ;
int h = bmp.GetHeight() ;
int sz = wxMax( w , h ) ;
if ( sz == 24 || sz == 64 )
{
wxBitmap scaleBmp( bmp.ConvertToImage().Scale( w * 2 , h * 2 ) ) ;
m_refData = new wxIconRefData( (WXHICON) scaleBmp.CreateIconRef(), bmp.GetWidth(), bmp.GetHeight() ) ;
}
else
{
m_refData = new wxIconRefData( (WXHICON) bmp.CreateIconRef() , bmp.GetWidth(), bmp.GetHeight() ) ;
}
}
IMPLEMENT_DYNAMIC_CLASS(wxICONResourceHandler, wxBitmapHandler)