kwin: Replace calls to QElapsedTimer::restart() with start()

It doesn't make sense to call restart() without using the return
value, or when the timer has never been started.
This commit is contained in:
Fredrik Höglund 2011-10-29 17:36:26 +02:00
parent eb9988b788
commit ebd0d9303b
2 changed files with 6 additions and 5 deletions

View file

@ -168,7 +168,7 @@ void Workspace::setupCompositing()
} else
vBlankInterval = 1 << 10; // no sync - DO NOT set "0", would cause div-by-zero segfaults.
vBlankPadding = 3; // vblank rounding errors... :-(
nextPaintReference.restart();
nextPaintReference.start();
checkCompositeTimer();
XCompositeRedirectSubwindows(display(), rootWindow(), CompositeRedirectManual);
new EffectsHandlerImpl(scene->compositingType()); // sets also the 'effects' pointer
@ -393,10 +393,10 @@ void Workspace::performCompositing()
if (scene->waitSyncAvailable()) {
// vsync: paint the scene, than rebase the timer and use the duration for next timeout estimation
scene->paint(repaints, windows);
nextPaintReference.restart();
nextPaintReference.start();
} else {
// no vsyc -> inversion: reset the timer, then paint the scene, this way we can provide a constant framerate
nextPaintReference.restart();
nextPaintReference.start();
scene->paint(repaints, windows);
}
// reset the roundin error corrective... :-(

View file

@ -172,11 +172,12 @@ void Scene::updateTimeDiff()
// Simply set it to one (zero would mean no change at all and could
// cause problems).
time_diff = 1;
last_time.start();
} else
time_diff = last_time.elapsed();
time_diff = last_time.restart();
if (time_diff < 0) // check time rollback
time_diff = 1;
last_time.restart();
}
// Painting pass is optimized away.