Add OSXMakeDPIFromScaleFactor() helper

No real changes, just avoid repeating wxRound(scaleFactor*72) in several
places and do it in this single function instead.
This commit is contained in:
Vadim Zeitlin
2020-07-21 17:13:41 +02:00
parent a2c55fa834
commit a8bb796f8c
3 changed files with 14 additions and 3 deletions

View File

@@ -2620,6 +2620,14 @@ bool wxWindowMac::OSXHandleKeyEvent( wxKeyEvent& event )
return handled ;
}
/* static */
wxSize wxWindowMac::OSXMakeDPIFromScaleFactor(double scaleFactor)
{
const int dpi = wxRound(scaleFactor*72.0);
return wxSize(dpi, dpi);
}
wxSize wxWindowMac::GetDPI() const
{
double scaleFactor;
@@ -2628,7 +2636,7 @@ wxSize wxWindowMac::GetDPI() const
else
scaleFactor = wxOSXGetMainScreenContentScaleFactor();
return wxSize(wxRound(scaleFactor*72.0),wxRound(scaleFactor*72.0));
return OSXMakeDPIFromScaleFactor(scaleFactor);
}
//