kwin: Use QDateTime::currentMSecsSinceEpoch() instead of QTime::currentTime().

icc-effect-5.14.5
Fredrik Höglund 2011-02-01 16:38:06 +01:00
parent 2d81d28e7a
commit 09dc033e8c
2 changed files with 7 additions and 6 deletions

View File

@ -196,7 +196,7 @@ void Workspace::setupCompositing()
} else } else
vBlankInterval = 1 << 10; // no sync - DO NOT set "0", would cause div-by-zero segfaults. vBlankInterval = 1 << 10; // no sync - DO NOT set "0", would cause div-by-zero segfaults.
vBlankPadding = 3; // vblank rounding errors... :-( vBlankPadding = 3; // vblank rounding errors... :-(
nextPaintReference = QTime::currentTime(); nextPaintReference = QDateTime::currentMSecsSinceEpoch();
checkCompositeTimer(); checkCompositeTimer();
composite_paint_times.clear(); composite_paint_times.clear();
XCompositeRedirectSubwindows(display(), rootWindow(), CompositeRedirectManual); XCompositeRedirectSubwindows(display(), rootWindow(), CompositeRedirectManual);
@ -412,14 +412,15 @@ void Workspace::performCompositing()
QRegion repaints = repaints_region; QRegion repaints = repaints_region;
// clear all repaints, so that post-pass can add repaints for the next repaint // clear all repaints, so that post-pass can add repaints for the next repaint
repaints_region = QRegion(); repaints_region = QRegion();
QTime t = QTime::currentTime(); QElapsedTimer t;
t.start();
if (scene->waitSyncAvailable()) { if (scene->waitSyncAvailable()) {
// vsync: paint the scene, than rebase the timer and use the duration for next timeout estimation // vsync: paint the scene, than rebase the timer and use the duration for next timeout estimation
scene->paint(repaints, windows); scene->paint(repaints, windows);
nextPaintReference = QTime::currentTime(); nextPaintReference = QDateTime::currentMSecsSinceEpoch();
} else { } else {
// no vsyc -> inversion: reset the timer, then paint the scene, this way we can provide a constant framerate // no vsyc -> inversion: reset the timer, then paint the scene, this way we can provide a constant framerate
nextPaintReference = QTime::currentTime(); nextPaintReference = QDateTime::currentMSecsSinceEpoch();
scene->paint(repaints, windows); scene->paint(repaints, windows);
} }
// reset the roundin error corrective... :-( // reset the roundin error corrective... :-(
@ -461,7 +462,7 @@ void Workspace::setCompositeTimer()
return; return;
// interval - "time since last paint completion" - "time we need to paint" // interval - "time since last paint completion" - "time we need to paint"
uint passed = nextPaintReference.msecsTo(QTime::currentTime()) << 10; uint passed = (QDateTime::currentMSecsSinceEpoch() - nextPaintReference) << 10;
uint delay = fpsInterval; uint delay = fpsInterval;
if (scene->waitSyncAvailable()) { if (scene->waitSyncAvailable()) {
if (passed > fpsInterval) { if (passed > fpsInterval) {

View File

@ -1178,7 +1178,7 @@ private:
KSelectionOwner* cm_selection; KSelectionOwner* cm_selection;
bool compositingSuspended; bool compositingSuspended;
QBasicTimer compositeTimer; QBasicTimer compositeTimer;
QTime nextPaintReference; qint64 nextPaintReference;
QTimer mousePollingTimer; QTimer mousePollingTimer;
uint vBlankInterval, vBlankPadding, fpsInterval, estimatedRenderTime; uint vBlankInterval, vBlankPadding, fpsInterval, estimatedRenderTime;
int xrrRefreshRate; // used only for compositing int xrrRefreshRate; // used only for compositing