summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@digia.com>2015-01-21 16:07:08 +0100
committerTor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>2015-02-02 16:19:01 +0000
commitf568e511b7f6a2cbac0cec086fb49e2b5b19257c (patch)
tree652a8b656f04526a8a14d461479bdbb22abf7c41 /src/plugins/platforms
parent5abba00befd8ebb475803ffaf8cdf3dfcd3ae287 (diff)
iOS: Keep size and device pixel ratio of QIOSBackingStore in sync with window
We were only doing this for the size, which caused problems when moving a window from one screen to another where the two screens had different device pixel ratios. Change-Id: If56df34677417369639ee8e4df05820fddd9198d Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@theqtcompany.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r--src/plugins/platforms/ios/qiosbackingstore.h4
-rw-r--r--src/plugins/platforms/ios/qiosbackingstore.mm16
2 files changed, 10 insertions, 10 deletions
diff --git a/src/plugins/platforms/ios/qiosbackingstore.h b/src/plugins/platforms/ios/qiosbackingstore.h
index eff7455247..555dfa2a5d 100644
--- a/src/plugins/platforms/ios/qiosbackingstore.h
+++ b/src/plugins/platforms/ios/qiosbackingstore.h
@@ -38,6 +38,8 @@
QT_BEGIN_NAMESPACE
+class QOpenGLPaintDevice;
+
class QIOSBackingStore : public QPlatformBackingStore
{
public:
@@ -53,7 +55,7 @@ public:
private:
QOpenGLContext *m_context;
- QPaintDevice *m_device;
+ QOpenGLPaintDevice *m_device;
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/ios/qiosbackingstore.mm b/src/plugins/platforms/ios/qiosbackingstore.mm
index 5ea5fbd8d1..7f622cf7c1 100644
--- a/src/plugins/platforms/ios/qiosbackingstore.mm
+++ b/src/plugins/platforms/ios/qiosbackingstore.mm
@@ -73,19 +73,17 @@ QIOSBackingStore::~QIOSBackingStore()
void QIOSBackingStore::beginPaint(const QRegion &)
{
m_context->makeCurrent(window());
-
- QIOSWindow *iosWindow = static_cast<QIOSWindow *>(window()->handle());
- static_cast<QOpenGLPaintDevice *>(paintDevice())->setSize(window()->size() * iosWindow->devicePixelRatio());
}
QPaintDevice *QIOSBackingStore::paintDevice()
{
- if (!m_device) {
- QIOSWindow *iosWindow = static_cast<QIOSWindow *>(window()->handle());
- QOpenGLPaintDevice *openGLDevice = new QOpenGLPaintDevice(window()->size() * iosWindow->devicePixelRatio());
- openGLDevice->setDevicePixelRatio(iosWindow->devicePixelRatio());
- m_device = openGLDevice;
- }
+ if (!m_device)
+ m_device = new QOpenGLPaintDevice;
+
+ // Keep paint device size and device pixel ratio in sync with window
+ qreal devicePixelRatio = window()->devicePixelRatio();
+ m_device->setSize(window()->size() * devicePixelRatio);
+ m_device->setDevicePixelRatio(devicePixelRatio);
return m_device;
}