Qt: Fix pausing and disable double buffering, since it is no longer needed
Jeffrey Pfau jeffrey@endrift.com
Thu, 06 Aug 2015 19:42:08 -0700
2 files changed,
8 insertions(+),
9 deletions(-)
M
src/platform/qt/Display.cpp
→
src/platform/qt/Display.cpp
@@ -22,7 +22,7 @@ #endif
Display* Display::create(QWidget* parent) { #ifdef BUILD_GL - QGLFormat format(QGLFormat(QGL::Rgba | QGL::DoubleBuffer)); + QGLFormat format(QGLFormat(QGL::Rgba | QGL::SingleBuffer)); format.setSwapInterval(1); #endif
M
src/platform/qt/DisplayGL.cpp
→
src/platform/qt/DisplayGL.cpp
@@ -244,12 +244,9 @@ }
void PainterGL::pause() { m_active = false; - // Make sure both buffers are filled - m_gl->makeCurrent(); - dequeueAll(); - forceDraw(); - forceDraw(); - m_gl->doneCurrent(); + if (!m_queue.isEmpty()) { + QMetaObject::invokeMethod(this, "pause", Qt::QueuedConnection); + } } void PainterGL::unpause() {@@ -293,12 +290,14 @@ m_mutex.unlock();
} void PainterGL::dequeueAll() { - uint32_t* buffer; + uint32_t* buffer = 0; m_mutex.lock(); while (!m_queue.isEmpty()) { buffer = m_queue.dequeue(); m_free.append(buffer); } - m_backend.d.postFrame(&m_backend.d, buffer); + if (buffer) { + m_backend.d.postFrame(&m_backend.d, buffer); + } m_mutex.unlock(); }