Add wxRescaleCoord() helper and use it

No real changes, just make the code a bit shorter and more clear by
using a dedicated function rather than wxMulDivInt32() directly.
This commit is contained in:
Vadim Zeitlin
2021-07-11 19:31:17 +01:00
parent 7c6f290995
commit 453468f2f9
5 changed files with 50 additions and 28 deletions

View File

@@ -185,11 +185,8 @@ wxSize wxButtonBase::GetDefaultSize(wxWindow* win)
// character width metadata stored in the font; see
// http://support.microsoft.com/default.aspx/kb/145994 for detailed
// discussion.
//
// NB: wxMulDivInt32() is used, because it correctly rounds the result
s_sizeBtn.SetAtNewDPI(wxSize(wxMulDivInt32(50, base.x, 4),
wxMulDivInt32(14, base.y, 8)));
s_sizeBtn.SetAtNewDPI(wxRescaleCoord(wxSize(50, 14), base, wxSize(4, 8)));
}
return s_sizeBtn.Get();