Add wxWindow::GetDPIScaleFactor()

This function replaces some uses of GetContentScaleFactor(), where a
factor greater than 1 must be used even under the platforms not doing
any logical/physical pixel mapping, such as MSW.

For now GetContentScaleFactor() is still unchanged, but it will return 1
for such platforms in the future and adding GetDPIScaleFactor() allows
to avoid changing the behaviour of the code which relied on its current
behaviour.
This commit is contained in:
Vadim Zeitlin
2020-07-18 22:27:28 +02:00
parent 0645ff25a7
commit 1422991602
8 changed files with 42 additions and 18 deletions

View File

@@ -533,6 +533,10 @@ public:
// e.g. 2.0 for a window on a retina screen
virtual double GetContentScaleFactor() const;
// Return the ratio of the DPI used by this window to the standard DPI,
// e.g. 1 for standard DPI screens and 2 for "200% scaling".
double GetDPIScaleFactor() const;
// return the size of the left/right and top/bottom borders in x and y
// components of the result respectively
virtual wxSize GetWindowBorderSize() const;
@@ -957,7 +961,7 @@ public:
// DPI-independent pixels, or DIPs, are pixel values for the standard
// 96 DPI display, they are scaled to take the current resolution into
// account (i.e. multiplied by the same factor as returned by
// GetContentScaleFactor()) if necessary for the current platform.
// GetDPIScaleFactor()) if necessary for the current platform.
//
// To support monitor-specific resolutions, prefer using the non-static
// member functions or use a valid (non-null) window pointer.