diff options
author | Tor Arne Vestbø <tor.arne.vestbo@digia.com> | 2013-02-27 23:57:04 +0100 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@digia.com> | 2013-02-27 23:57:06 +0100 |
commit | 70d5cb406fda70d175faac5f9588f0e345588c56 (patch) | |
tree | 1b7e95bdf142da42a5d9fea6068a46c78055eddd /src/gui/opengl/qopenglpaintdevice.cpp | |
parent | 3b5600f6ee9f2982c5a93250e577f87a34fe32d1 (diff) | |
parent | 9b05f675e311d1962f0670193cf4df75a07f4999 (diff) |
Merge branch 'ios' into dev
Change-Id: I5d18d502908920a44bbc506aba77dd805d94d843
Diffstat (limited to 'src/gui/opengl/qopenglpaintdevice.cpp')
-rw-r--r-- | src/gui/opengl/qopenglpaintdevice.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/gui/opengl/qopenglpaintdevice.cpp b/src/gui/opengl/qopenglpaintdevice.cpp index 0b3d9dc46d..d55d6a91bf 100644 --- a/src/gui/opengl/qopenglpaintdevice.cpp +++ b/src/gui/opengl/qopenglpaintdevice.cpp @@ -116,6 +116,7 @@ public: qreal dpmx; qreal dpmy; + qreal devicePixelRatio; bool flipped; @@ -178,6 +179,7 @@ QOpenGLPaintDevicePrivate::QOpenGLPaintDevicePrivate(const QSize &sz) , ctx(QOpenGLContext::currentContext()) , dpmx(qt_defaultDpiX() * 100. / 2.54) , dpmy(qt_defaultDpiY() * 100. / 2.54) + , devicePixelRatio(1.0) , flipped(false) , engine(0) { @@ -249,6 +251,14 @@ void QOpenGLPaintDevice::setSize(const QSize &size) } /*! + Sets the device pixel ratio for the paint device to \a devicePixelRatio. +*/ +void QOpenGLPaintDevice::setDevicePixelRatio(qreal devicePixelRatio) +{ + d_ptr->devicePixelRatio = devicePixelRatio; +} + +/*! \reimp */ @@ -272,9 +282,9 @@ int QOpenGLPaintDevice::metric(QPaintDevice::PaintDeviceMetric metric) const case PdmDpiY: return qRound(d_ptr->dpmy * 0.0254); case PdmPhysicalDpiX: - return qRound(d_ptr->dpmx * 0.0254); + return qRound(d_ptr->dpmx * 0.0254 * d_ptr->devicePixelRatio); case PdmPhysicalDpiY: - return qRound(d_ptr->dpmy * 0.0254); + return qRound(d_ptr->dpmy * 0.0254 * d_ptr->devicePixelRatio); default: qWarning("QOpenGLPaintDevice::metric() - metric %d not known", metric); return 0; |