Avoid invalidating the best size in wxStaticBitmap unnecessarily

This is just a micro-optimization: there is no need to call
InvalidateBestSize() if the size of the bitmap doesn't actually change
(as will most often be the case when this method is called after the
control creation).
This commit is contained in:
Vadim Zeitlin
2019-05-16 22:17:06 +02:00
parent 6c59a4e7af
commit 65e5c3dbc7

View File

@@ -287,7 +287,9 @@ void wxStaticBitmap::SetImageNoCopy( wxGDIImage* image)
sizeNew = image->GetSize();
Free();
InvalidateBestSize();
if ( sizeNew != sizeOld )
InvalidateBestSize();
m_isIcon = image->IsKindOf( wxCLASSINFO(wxIcon) );
// the image has already been copied