Simplify PPI and scale factor handling in wxDisplay

Don't try computing the PPI ourselves from the physical size and the
number of pixels, this doesn't work and nobody else does it like this.

Just assume that we're using standard PPI by default and use
toolkit-specific functions for the platforms with support for high DPI.
This commit is contained in:
Vadim Zeitlin
2020-08-14 15:17:59 +02:00
parent 4e6df3f7b2
commit bcb101b9e9
4 changed files with 13 additions and 85 deletions

View File

@@ -115,13 +115,11 @@ public:
// return the scale factor used to convert logical pixels to physical ones
virtual double GetScaleFactor() const { return 1.0; }
// return the resolution of the display, uses GetSize(), GetScaleFactor()
// and GetSizeMM() by default but can be also overridden directly
virtual wxSize GetPPI() const;
// return the resolution of the display, by default uses GetScaleFactor(),
// but can be also overridden directly, as is done in wxMSW
virtual wxSize GetPPI() const { return wxDisplay::GetStdPPI()*GetScaleFactor(); }
// return the physical size of the display or (0, 0) if unknown: this is
// only used by GetPPI() implementation in the base class, so if GetPPI()
// is overridden, this one doesn't have to be implemented
// return the physical size of the display or (0, 0) if unknown
virtual wxSize GetSizeMM() const { return wxSize(0, 0); }
// return the name (may be empty)
@@ -149,11 +147,6 @@ protected:
// create the object providing access to the display with the given index
wxDisplayImpl(unsigned n) : m_index(n) { }
// Compute PPI from the sizes in pixels and mm.
//
// Return (0, 0) if physical size (in mm) is not known, i.e. 0.
static wxSize ComputePPI(int pxX, int pxY, int mmX, int mmY);
// the index of this display (0 is always the primary one)
const unsigned m_index;