From f568e511b7f6a2cbac0cec086fb49e2b5b19257c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 21 Jan 2015 16:07:08 +0100 Subject: iOS: Keep size and device pixel ratio of QIOSBackingStore in sync with window MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/ios/qiosbackingstore.h | 4 +++- src/plugins/platforms/ios/qiosbackingstore.mm | 16 +++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'src/plugins/platforms') 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(window()->handle()); - static_cast(paintDevice())->setSize(window()->size() * iosWindow->devicePixelRatio()); } QPaintDevice *QIOSBackingStore::paintDevice() { - if (!m_device) { - QIOSWindow *iosWindow = static_cast(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; } -- cgit v1.2.3