diff options
author | Tor Arne Vestbø <tor.arne.vestbo@digia.com> | 2015-01-21 16:07:08 +0100 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com> | 2015-02-02 16:19:01 +0000 |
commit | f568e511b7f6a2cbac0cec086fb49e2b5b19257c (patch) | |
tree | 652a8b656f04526a8a14d461479bdbb22abf7c41 /src/plugins/platforms/ios/qiosbackingstore.mm | |
parent | 5abba00befd8ebb475803ffaf8cdf3dfcd3ae287 (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/ios/qiosbackingstore.mm')
-rw-r--r-- | src/plugins/platforms/ios/qiosbackingstore.mm | 16 |
1 files changed, 7 insertions, 9 deletions
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; } |