Avoid updating wxStaticBitmap unnecessarily
If the kind of the bitmap/icon used by the control didn't change (which will be most often the case, as using both an icon and a bitmap with the same control is vanishingly rare), there is no need to update the window style. No real changes, this is just a micro-optimization.
This commit is contained in:
@@ -289,6 +289,8 @@ void wxStaticBitmap::SetImageNoCopy( wxGDIImage* image)
|
||||
if ( image )
|
||||
sizeNew = image->GetSize();
|
||||
|
||||
const bool wasIcon = m_isIcon;
|
||||
|
||||
Free();
|
||||
|
||||
if ( sizeNew != sizeOld )
|
||||
@@ -326,9 +328,13 @@ void wxStaticBitmap::SetImageNoCopy( wxGDIImage* image)
|
||||
}
|
||||
}
|
||||
#endif // wxUSE_WXDIB
|
||||
wxMSWWinStyleUpdater(GetHwnd())
|
||||
.TurnOff(SS_BITMAP | SS_ICON)
|
||||
.TurnOn(m_isIcon ? SS_ICON : SS_BITMAP);
|
||||
|
||||
if ( m_isIcon != wasIcon )
|
||||
{
|
||||
wxMSWWinStyleUpdater(GetHwnd())
|
||||
.TurnOff(SS_BITMAP | SS_ICON)
|
||||
.TurnOn(m_isIcon ? SS_ICON : SS_BITMAP);
|
||||
}
|
||||
|
||||
MSWReplaceImageHandle((WXLPARAM)handle);
|
||||
|
||||
|
Reference in New Issue
Block a user