Cocoa: Make the hellowindow opengl example work.
You're not supposed to use NSOpenGLView and NSOpenGLContext at the same time - it's one or the other. Qmlscene worked because it was hitting the raster path that doesn't have a NSOpenGLView. Remove the NSOpenGLView path and m_windowSurfaceView. Change-Id: I10358851a94cd1780a312af09bbb7cf5db8f984f Reviewed-on: http://codereview.qt.nokia.com/3862 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com> Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
This commit is contained in:
parent
42f2da5e6b
commit
d610fbc13e
@ -84,7 +84,7 @@ void QCocoaBackingStore::flush(QWindow *widget, const QRegion ®ion, const QPo
|
|||||||
QRect geo = region.boundingRect();
|
QRect geo = region.boundingRect();
|
||||||
|
|
||||||
NSRect rect = NSMakeRect(geo.x(), geo.y(), geo.width(), geo.height());
|
NSRect rect = NSMakeRect(geo.x(), geo.y(), geo.width(), geo.height());
|
||||||
[m_cocoaWindow->m_windowSurfaceView displayRect:rect];
|
[m_cocoaWindow->m_contentView displayRect:rect];
|
||||||
}
|
}
|
||||||
|
|
||||||
void QCocoaBackingStore::resize(const QSize &size, const QRegion &)
|
void QCocoaBackingStore::resize(const QSize &size, const QRegion &)
|
||||||
@ -92,7 +92,7 @@ void QCocoaBackingStore::resize(const QSize &size, const QRegion &)
|
|||||||
delete m_image;
|
delete m_image;
|
||||||
m_image = new QImage(size,QImage::Format_ARGB32_Premultiplied);
|
m_image = new QImage(size,QImage::Format_ARGB32_Premultiplied);
|
||||||
NSSize newSize = NSMakeSize(size.width(),size.height());
|
NSSize newSize = NSMakeSize(size.width(),size.height());
|
||||||
[static_cast<QNSView *>(m_cocoaWindow->m_windowSurfaceView) setImage:m_image];
|
[static_cast<QNSView *>(m_cocoaWindow->m_contentView) setImage:m_image];
|
||||||
}
|
}
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
@ -39,6 +39,8 @@ void QCocoaGLContext::swapBuffers(QPlatformSurface *surface)
|
|||||||
|
|
||||||
bool QCocoaGLContext::makeCurrent(QPlatformSurface *surface)
|
bool QCocoaGLContext::makeCurrent(QPlatformSurface *surface)
|
||||||
{
|
{
|
||||||
|
QCocoaAutoReleasePool pool;
|
||||||
|
|
||||||
QWindow *window = static_cast<QCocoaWindow *>(surface)->window();
|
QWindow *window = static_cast<QCocoaWindow *>(surface)->window();
|
||||||
setActiveWindow(window);
|
setActiveWindow(window);
|
||||||
|
|
||||||
@ -61,7 +63,7 @@ void QCocoaGLContext::setActiveWindow(QWindow *window)
|
|||||||
QCocoaWindow *cocoaWindow = static_cast<QCocoaWindow *>(window->handle());
|
QCocoaWindow *cocoaWindow = static_cast<QCocoaWindow *>(window->handle());
|
||||||
cocoaWindow->setCurrentContext(this);
|
cocoaWindow->setCurrentContext(this);
|
||||||
|
|
||||||
NSView *view = cocoaWindow->windowSurfaceView();
|
NSView *view = cocoaWindow->contentView();
|
||||||
[m_context setView:view];
|
[m_context setView:view];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,7 +72,6 @@ public:
|
|||||||
|
|
||||||
WId winId() const;
|
WId winId() const;
|
||||||
NSView *contentView() const;
|
NSView *contentView() const;
|
||||||
NSView *windowSurfaceView() const;
|
|
||||||
|
|
||||||
void windowDidMove();
|
void windowDidMove();
|
||||||
void windowDidResize();
|
void windowDidResize();
|
||||||
@ -92,7 +91,6 @@ private:
|
|||||||
friend class QCocoaBackingStore;
|
friend class QCocoaBackingStore;
|
||||||
QNSWindow *m_nsWindow;
|
QNSWindow *m_nsWindow;
|
||||||
QNSView *m_contentView;
|
QNSView *m_contentView;
|
||||||
NSView *m_windowSurfaceView;
|
|
||||||
quint32 m_windowAttributes;
|
quint32 m_windowAttributes;
|
||||||
quint32 m_windowClass;
|
quint32 m_windowClass;
|
||||||
QCocoaGLContext *m_glContext;
|
QCocoaGLContext *m_glContext;
|
||||||
|
@ -90,16 +90,6 @@ QCocoaWindow::QCocoaWindow(QWindow *tlw)
|
|||||||
|
|
||||||
m_contentView = [[QNSView alloc] initWithQWindow:tlw];
|
m_contentView = [[QNSView alloc] initWithQWindow:tlw];
|
||||||
|
|
||||||
if (tlw->surfaceType() == QWindow::OpenGLSurface) {
|
|
||||||
NSRect glFrame = globalGeometry(window()->geometry());
|
|
||||||
m_windowSurfaceView = [[NSOpenGLView alloc] initWithFrame : glFrame pixelFormat : QCocoaGLContext::createNSOpenGLPixelFormat() ];
|
|
||||||
[m_contentView setAutoresizesSubviews : YES];
|
|
||||||
[m_windowSurfaceView setAutoresizingMask : (NSViewWidthSizable | NSViewHeightSizable)];
|
|
||||||
[m_contentView addSubview : m_windowSurfaceView];
|
|
||||||
} else {
|
|
||||||
m_windowSurfaceView = m_contentView;
|
|
||||||
}
|
|
||||||
|
|
||||||
setGeometry(tlw->geometry());
|
setGeometry(tlw->geometry());
|
||||||
|
|
||||||
[m_nsWindow setContentView:m_contentView];
|
[m_nsWindow setContentView:m_contentView];
|
||||||
@ -166,11 +156,6 @@ NSView *QCocoaWindow::contentView() const
|
|||||||
return [m_nsWindow contentView];
|
return [m_nsWindow contentView];
|
||||||
}
|
}
|
||||||
|
|
||||||
NSView *QCocoaWindow::windowSurfaceView() const
|
|
||||||
{
|
|
||||||
return m_windowSurfaceView;
|
|
||||||
}
|
|
||||||
|
|
||||||
void QCocoaWindow::windowDidMove()
|
void QCocoaWindow::windowDidMove()
|
||||||
{
|
{
|
||||||
if (m_glContext)
|
if (m_glContext)
|
||||||
|
Loading…
Reference in New Issue
Block a user