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 )
|
if ( image )
|
||||||
sizeNew = image->GetSize();
|
sizeNew = image->GetSize();
|
||||||
|
|
||||||
|
const bool wasIcon = m_isIcon;
|
||||||
|
|
||||||
Free();
|
Free();
|
||||||
|
|
||||||
if ( sizeNew != sizeOld )
|
if ( sizeNew != sizeOld )
|
||||||
@@ -326,9 +328,13 @@ void wxStaticBitmap::SetImageNoCopy( wxGDIImage* image)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // wxUSE_WXDIB
|
#endif // wxUSE_WXDIB
|
||||||
wxMSWWinStyleUpdater(GetHwnd())
|
|
||||||
.TurnOff(SS_BITMAP | SS_ICON)
|
if ( m_isIcon != wasIcon )
|
||||||
.TurnOn(m_isIcon ? SS_ICON : SS_BITMAP);
|
{
|
||||||
|
wxMSWWinStyleUpdater(GetHwnd())
|
||||||
|
.TurnOff(SS_BITMAP | SS_ICON)
|
||||||
|
.TurnOn(m_isIcon ? SS_ICON : SS_BITMAP);
|
||||||
|
}
|
||||||
|
|
||||||
MSWReplaceImageHandle((WXLPARAM)handle);
|
MSWReplaceImageHandle((WXLPARAM)handle);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user