summaryrefslogtreecommitdiffstats
path: root/src/gui/painting/qpaintdevice.h
diff options
context:
space:
mode:
authorMorten Johan Sørvig <morten.sorvig@digia.com>2014-05-28 11:21:29 +0200
committerMorten Johan Sørvig <morten.sorvig@digia.com>2015-03-26 10:57:24 +0100
commit3cede847c39269374c52dcf156dc982d7a51f29c (patch)
treebde9cc0eb9c5c445d0c353c7dc7c6f5d816826fa /src/gui/painting/qpaintdevice.h
parent7dd5726380f5d5422edd4b71c6beba6d02b4e3df (diff)
WIP: Add PdmDevicePixelRatioScaled.
Work around QPainDevice::metric's int return type by adding a new metric that returns a scaled devicePixelRatio. Choose a scale factor that gives us more than enough range. The QPainDevice::devicePixelRatio() convenience accessor is public API and can unfortunately not be changed to return a qreal. Add devicePixelRatioF() which returns the (unscaled) devicePixelRatio. Change all call sites of QPainDevice::devicePixelRatio() to use QPainDevice::devicePixelRatioF(). Task-number: QTBUG-38858 Change-Id: Ia97c24e1c7b10241d6425fab2fa513702bb750b8
Diffstat (limited to 'src/gui/painting/qpaintdevice.h')
-rw-r--r--src/gui/painting/qpaintdevice.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/gui/painting/qpaintdevice.h b/src/gui/painting/qpaintdevice.h
index 7c756c66de..819116c585 100644
--- a/src/gui/painting/qpaintdevice.h
+++ b/src/gui/painting/qpaintdevice.h
@@ -58,7 +58,8 @@ public:
PdmDpiY,
PdmPhysicalDpiX,
PdmPhysicalDpiY,
- PdmDevicePixelRatio
+ PdmDevicePixelRatio,
+ PdmDevicePixelRatioScaled
};
virtual ~QPaintDevice();
@@ -76,9 +77,13 @@ public:
int physicalDpiX() const { return metric(PdmPhysicalDpiX); }
int physicalDpiY() const { return metric(PdmPhysicalDpiY); }
int devicePixelRatio() const { return metric(PdmDevicePixelRatio); }
+ qreal devicePixelRatioF() const { return metric(PdmDevicePixelRatioScaled) / devicePixelRatioFScale; }
int colorCount() const { return metric(PdmNumColors); }
int depth() const { return metric(PdmDepth); }
+ // ### Classes that are not QPaintDevice subclasses are implementing metric()
+ // ### There needs to be some kind of (semi)-public API.
+ static qreal devicePixelRatioFScale;
protected:
QPaintDevice();
virtual int metric(PaintDeviceMetric metric) const;
@@ -87,7 +92,6 @@ protected:
virtual QPainter *sharedPainter() const;
ushort painters; // refcount
-
private:
Q_DISABLE_COPY(QPaintDevice)