X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d2ec5847d6cf4b1bd45a60682eeb32cee5b07ea4..c9ccc09c64f4c29d4667796bef7b507d9e8d25ed:/src/osx/carbon/icon.cpp?ds=sidebyside diff --git a/src/osx/carbon/icon.cpp b/src/osx/carbon/icon.cpp index 50bd2b8c5a..d99c5a1e64 100644 --- a/src/osx/carbon/icon.cpp +++ b/src/osx/carbon/icon.cpp @@ -338,6 +338,7 @@ bool wxIcon::LoadIconFromBundleResource(const wxString& resourceName, int desire { err = GetIconRefFromIconFamilyPtr( *iconFamily, GetHandleSize((Handle) iconFamily), &iconRef ); } + ReleaseResource( (Handle) iconFamily ); } } @@ -439,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)