summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@digia.com>2013-02-28 18:31:11 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-02-28 19:22:05 +0100
commit0520631b2ba04fb99d3d46385f04279cd89a7732 (patch)
treec970fab36c889741dedcb708e520fe9ec517fc07 /src/gui
parent439002cddeb32766ea9806ac8b5cf9a973ed0f13 (diff)
parent70d5cb406fda70d175faac5f9588f0e345588c56 (diff)
Merge "Merge branch 'ios' into dev" into refs/staging/dev
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/gui.pro4
-rw-r--r--src/gui/opengl/qopenglpaintdevice.cpp14
-rw-r--r--src/gui/opengl/qopenglpaintdevice.h1
3 files changed, 14 insertions, 5 deletions
diff --git a/src/gui/gui.pro b/src/gui/gui.pro
index 058cfe92ec..f21c7a5ce7 100644
--- a/src/gui/gui.pro
+++ b/src/gui/gui.pro
@@ -18,9 +18,7 @@ testcocoon {
load(testcocoon)
}
-mac {
- LIBS_PRIVATE += -framework Cocoa
-}
+mac:!ios: LIBS_PRIVATE += -framework Cocoa
CONFIG += simd
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;
diff --git a/src/gui/opengl/qopenglpaintdevice.h b/src/gui/opengl/qopenglpaintdevice.h
index 731000f131..5868a5740a 100644
--- a/src/gui/opengl/qopenglpaintdevice.h
+++ b/src/gui/opengl/qopenglpaintdevice.h
@@ -68,6 +68,7 @@ public:
QOpenGLContext *context() const;
QSize size() const;
void setSize(const QSize &size);
+ void setDevicePixelRatio(qreal devicePixelRatio);
qreal dotsPerMeterX() const;
qreal dotsPerMeterY() const;