Qt: Simplify high-framerate fix (fixes #545)

This commit is contained in:
Vicki Pfau 2017-04-03 10:54:49 -07:00
parent daaad65b8e
commit 0191bb0768
1 changed files with 8 additions and 9 deletions

View File

@ -320,15 +320,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();
@ -337,6 +328,14 @@ void PainterGL::draw() {
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);
}