From 4ab5870699dfd9f4282d4fa59e44f662a11d2587 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 16 Aug 2013 15:32:46 +0200 Subject: iOS: Determine render buffer resize based on CA layer, not Qt window MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Richard Moe Gustavsen --- src/plugins/platforms/ios/qioscontext.mm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/plugins/platforms/ios/qioscontext.mm') 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(surface); - if (framebufferObject.renderbufferWidth != platformWindow->effectiveWidth() || - framebufferObject.renderbufferHeight != platformWindow->effectiveHeight()) { + UIView *view = reinterpret_cast(platformWindow->winId()); + CAEAGLLayer *layer = static_cast(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(platformWindow->winId()); - CAEAGLLayer *layer = static_cast(view.layer); [m_eaglContext renderbufferStorage:GL_RENDERBUFFER fromDrawable:layer]; glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_WIDTH, &framebufferObject.renderbufferWidth); -- cgit v1.2.3