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>
This commit is contained in:
parent
b911e058fa
commit
1caa0c023f
@ -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()
|
||||
|
@ -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());
|
||||
|
Loading…
x
Reference in New Issue
Block a user