diff options
author | Tor Arne Vestbø <tor.arne.vestbo@digia.com> | 2013-08-16 15:32:46 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-08-23 11:28:48 +0200 |
commit | 4ab5870699dfd9f4282d4fa59e44f662a11d2587 (patch) | |
tree | 41bebaea9e118fc333eb790e1d5b1f4f87a78f11 /src/plugins/platforms/ios/qioscontext.mm | |
parent | 1baf293548aa859e922dface4cd7b4bac5754b3c (diff) |
iOS: Determine render buffer resize based on CA layer, not Qt window
We resize the render-buffer based on the CALayer of the UIView that's
backing the QPlatformWindow, so the logic in defaultFramebufferObject()
to determine if a resize is needed should be based on the relationship
between the render buffer-and the CALayer, not the render-buffer and
the QPlatformWindow.
There is still an issue of the QPlatformWindow and its UIView/CALayer
not being in sync, but that's a separate issue.
Change-Id: I84f617d07ec64fea0d027473e9720523eeae0c7a
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
Diffstat (limited to 'src/plugins/platforms/ios/qioscontext.mm')
-rw-r--r-- | src/plugins/platforms/ios/qioscontext.mm | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/plugins/platforms/ios/qioscontext.mm b/src/plugins/platforms/ios/qioscontext.mm index 85f560a722..0c4bee1ef0 100644 --- a/src/plugins/platforms/ios/qioscontext.mm +++ b/src/plugins/platforms/ios/qioscontext.mm @@ -151,17 +151,17 @@ GLuint QIOSContext::defaultFramebufferObject(QPlatformSurface *surface) const connect(window, SIGNAL(destroyed(QObject*)), this, SLOT(windowDestroyed(QObject*))); } - // Ensure that the FBO's buffers match the size of the window + // Ensure that the FBO's buffers match the size of the layer QIOSWindow *platformWindow = static_cast<QIOSWindow *>(surface); - if (framebufferObject.renderbufferWidth != platformWindow->effectiveWidth() || - framebufferObject.renderbufferHeight != platformWindow->effectiveHeight()) { + UIView *view = reinterpret_cast<UIView *>(platformWindow->winId()); + CAEAGLLayer *layer = static_cast<CAEAGLLayer *>(view.layer); + if (framebufferObject.renderbufferWidth != (layer.frame.size.width * layer.contentsScale) || + framebufferObject.renderbufferHeight != (layer.frame.size.height * layer.contentsScale)) { [EAGLContext setCurrentContext:m_eaglContext]; glBindFramebuffer(GL_FRAMEBUFFER, framebufferObject.handle); glBindRenderbuffer(GL_RENDERBUFFER, framebufferObject.colorRenderbuffer); - UIView *view = reinterpret_cast<UIView *>(platformWindow->winId()); - CAEAGLLayer *layer = static_cast<CAEAGLLayer *>(view.layer); [m_eaglContext renderbufferStorage:GL_RENDERBUFFER fromDrawable:layer]; glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_WIDTH, &framebufferObject.renderbufferWidth); |