iOS: Allow QBackingStore::flush() without beginPaint()

The QBackingStore API doesn't require clients to precede flush() with a
beginPaint() call, but our backingstore is backed by a GL context, so
it's up to us to ensure it's current before swapping.

Change-Id: Ia6119bf0e835448b1fd383d933df6f88fa4f298a
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
bb10
Tor Arne Vestbø 2013-11-21 17:16:27 +01:00 committed by The Qt Project
parent c25385ae1e
commit c38225229d
1 changed files with 5 additions and 3 deletions

View File

@ -56,6 +56,9 @@ QIOSBackingStore::QIOSBackingStore(QWindow *window)
fmt.setDepthBufferSize(16);
fmt.setStencilBufferSize(8);
// Needed to prevent QOpenGLContext::makeCurrent() from failing
window->setSurfaceType(QSurface::OpenGLSurface);
m_context->setFormat(fmt);
m_context->setScreen(window->screen());
m_context->create();
@ -69,9 +72,6 @@ QIOSBackingStore::~QIOSBackingStore()
void QIOSBackingStore::beginPaint(const QRegion &)
{
// Needed to prevent QOpenGLContext::makeCurrent() from failing
window()->setSurfaceType(QSurface::OpenGLSurface);
m_context->makeCurrent(window());
QIOSWindow *iosWindow = static_cast<QIOSWindow *>(window()->handle());
@ -102,6 +102,8 @@ void QIOSBackingStore::flush(QWindow *window, const QRegion &region, const QPoin
// the child window overlaps a sibling window that's draws using a separate QOpenGLContext.
return;
}
m_context->makeCurrent(window);
m_context->swapBuffers(window);
}