diff options
author | Gabriel de Dietrich <gabriel.dedietrich@digia.com> | 2013-05-13 15:34:05 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-05-15 05:06:15 +0200 |
commit | 1caa0c023f4fa60446094e53f22ee79771130e2f (patch) | |
tree | 94e3f6f7ceea932243f25ea7bd15314b92622e1f /src/plugins/platforms/cocoa | |
parent | b911e058fae9274ee1144ec67bad76ef0c1e0a84 (diff) |
Cocoa: Fix Open GL resolution in high-dpi
We permanently enable 'wantsBestResolutionOpenGLSurface' when creating
an Open GL window/surface. We were enabling it once we would detect a
high-dpi Cocoa backend, whitout ever turning it off. Leaving it 'on' on
non-high-dpi displays should not change anything.
Task-number: QTBUG-31000
Change-Id: I3d0c77f7b36f3c22dacd04a50fcc5a7d88af32c0
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
Diffstat (limited to 'src/plugins/platforms/cocoa')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoaglcontext.mm | 12 | ||||
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoawindow.mm | 10 |
2 files changed, 10 insertions, 12 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.mm b/src/plugins/platforms/cocoa/qcocoaglcontext.mm index d4673baaef..3dee137038 100644 --- a/src/plugins/platforms/cocoa/qcocoaglcontext.mm +++ b/src/plugins/platforms/cocoa/qcocoaglcontext.mm @@ -133,18 +133,6 @@ void QCocoaGLContext::setActiveWindow(QWindow *window) cocoaWindow->setCurrentContext(this); [(QNSView *) cocoaWindow->contentView() setQCocoaGLContext:this]; - - // Enable high-dpi OpenGL for retina displays. Enabling has the side - // effect that Cooca will start calling glViewport(0, 0, width, height), - // overriding any glViewport calls in application code. This is usually not a - // problem, except if the applcation wants to have a "custom" viewport. - // (like the hellogl example) -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7 - if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7) { - if (cocoaWindow->devicePixelRatio() > 1) - [cocoaWindow->contentView() setWantsBestResolutionOpenGLSurface:YES]; - } -#endif } void QCocoaGLContext::doneCurrent() diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index 999439d618..ac30338c39 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -220,6 +220,16 @@ QCocoaWindow::QCocoaWindow(QWindow *tlw) } else { m_qtView = [[QNSView alloc] initWithQWindow:tlw platformWindow:this]; m_contentView = m_qtView; +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7 + // Enable high-dpi OpenGL for retina displays. Enabling has the side + // effect that Cocoa will start calling glViewport(0, 0, width, height), + // overriding any glViewport calls in application code. This is usually not a + // problem, except if the appilcation wants to have a "custom" viewport. + // (like the hellogl example) + if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7 + && tlw->surfaceType() == QSurface::OpenGLSurface) + [m_contentView setWantsBestResolutionOpenGLSurface:YES]; +#endif } setGeometry(tlw->geometry()); recreateWindow(parent()); |