Call AdjustForBitmapMargins() only once in wxAnyButton

No real changes, just a tiny refactoring to avoid duplicating exactly
the same function call.
This commit is contained in:
Vadim Zeitlin
2021-04-24 14:59:05 +01:00
parent 6f888df474
commit 53eff92ea7

View File

@@ -589,9 +589,6 @@ wxSize wxAnyButton::DoGetBestSize() const
SIZE idealSize = { 0, 0 }; SIZE idealSize = { 0, 0 };
if ( ::SendMessage(GetHwnd(), BCM_GETIDEALSIZE, 0, (LPARAM)&idealSize) ) if ( ::SendMessage(GetHwnd(), BCM_GETIDEALSIZE, 0, (LPARAM)&idealSize) )
size.Set(idealSize.cx, idealSize.cy); size.Set(idealSize.cx, idealSize.cy);
if ( m_imageData )
AdjustForBitmapMargins(size);
} }
// If we failed to set the size using BCM_GETIDEALSIZE above, determine it // If we failed to set the size using BCM_GETIDEALSIZE above, determine it
@@ -621,11 +618,11 @@ wxSize wxAnyButton::DoGetBestSize() const
size = wxMSWButton::ComputeBestFittingSize(self, flags); size = wxMSWButton::ComputeBestFittingSize(self, flags);
} }
} }
if ( m_imageData )
AdjustForBitmapSize(size);
} }
if ( m_imageData )
AdjustForBitmapMargins(size);
return wxMSWButton::IncreaseToStdSizeAndCache(self, size); return wxMSWButton::IncreaseToStdSizeAndCache(self, size);
} }