all repos — mgba @ 9a5ac0bf72d88ef3a380eae86ad0a31ba5e102b6

mGBA Game Boy Advance Emulator

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
commit

9a5ac0bf72d88ef3a380eae86ad0a31ba5e102b6

parent

870c8ebb8c529daeb5326c836322a72114a76c5d

2 files changed, 8 insertions(+), 9 deletions(-)

jump to
M src/platform/qt/Display.cppsrc/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.cppsrc/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(); }