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:
@@ -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);
|
||||
}
|
||||
|
||||
//
|
||||
|
Reference in New Issue
Block a user