all repos — mgba @ 4a38f9b97998fb977f04d2b980830d3b697a6bd4

mGBA Game Boy Advance Emulator

Qt: Simplify high-framerate fix (fixes #545)
Vicki Pfau vi@endrift.com
Mon, 03 Apr 2017 10:54:49 -0700
commit

4a38f9b97998fb977f04d2b980830d3b697a6bd4

parent

35b5626053dea8a4c53c63b6da23831fea6bb649

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

jump to
M src/platform/qt/DisplayGL.cppsrc/platform/qt/DisplayGL.cpp

@@ -318,15 +318,6 @@ void PainterGL::draw() {

if (m_queue.isEmpty() || !mCoreThreadIsActive(m_context)) { return; } - if (!m_delayTimer.isValid()) { - m_delayTimer.start(); - } else if (m_delayTimer.elapsed() < 16) { - QMetaObject::invokeMethod(this, "draw", Qt::QueuedConnection); - QThread::usleep(500); - return; - } else { - m_delayTimer.restart(); - } if (mCoreSyncWaitFrameStart(&m_context->sync) || !m_queue.isEmpty()) { dequeue();

@@ -335,6 +326,14 @@ m_painter.begin(m_gl->context()->device());

performDraw(); m_painter.end(); m_backend->swap(m_backend); + if (!m_delayTimer.isValid()) { + m_delayTimer.start(); + } else { + while (m_delayTimer.elapsed() < 15) { + QThread::usleep(100); + } + m_delayTimer.restart(); + } } else { mCoreSyncWaitFrameEnd(&m_context->sync); }