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

This commit is contained in:
Vicki Pfau 2017-04-03 10:54:49 -07:00
parent 35b5626053
commit 4a38f9b979
1 changed files with 8 additions and 9 deletions

View File

@ -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 @@ 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);
}