summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeonardo Sobral Cunha <leo.cunha@nokia.com>2010-06-30 12:48:11 (GMT)
committerLeonardo Sobral Cunha <leo.cunha@nokia.com>2010-06-30 12:49:11 (GMT)
commit38a04b3a8c7a33f1636008e04d58690febcc22f5 (patch)
treea3defb11814aa0a773bd03b24c08224e0ecd9e3b
parentf141de3daa267c266f67def765adb934138db080 (diff)
downloadQt-38a04b3a8c7a33f1636008e04d58690febcc22f5.zip
Qt-38a04b3a8c7a33f1636008e04d58690febcc22f5.tar.gz
Qt-38a04b3a8c7a33f1636008e04d58690febcc22f5.tar.bz2
Avoid calling time.elapsed() twice in abstract animation
Reviewed-by: Thierry
-rw-r--r--src/corelib/animation/qabstractanimation.cpp5
-rw-r--r--src/corelib/animation/qabstractanimation_p.h2
2 files changed, 4 insertions, 3 deletions
diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp
index 7feb3f7..641b42b 100644
--- a/src/corelib/animation/qabstractanimation.cpp
+++ b/src/corelib/animation/qabstractanimation.cpp
@@ -205,9 +205,10 @@ void QUnifiedTimer::ensureTimerUpdate()
void QUnifiedTimer::updateAnimationsTime()
{
+ qint64 totalElapsed = time.elapsed();
// ignore consistentTiming in case the pause timer is active
int delta = (consistentTiming && !isPauseTimerActive) ?
- timingInterval : time.elapsed() - lastTick;
+ timingInterval : totalElapsed - lastTick;
if (slowMode) {
if (slowdownFactor > 0)
delta = qRound(delta / slowdownFactor);
@@ -215,7 +216,7 @@ void QUnifiedTimer::updateAnimationsTime()
delta = 0;
}
- lastTick = time.elapsed();
+ lastTick = totalElapsed;
//we make sure we only call update time if the time has actually changed
//it might happen in some cases that the time doesn't change because events are delayed
diff --git a/src/corelib/animation/qabstractanimation_p.h b/src/corelib/animation/qabstractanimation_p.h
index 6ff18f5..d3d4098 100644
--- a/src/corelib/animation/qabstractanimation_p.h
+++ b/src/corelib/animation/qabstractanimation_p.h
@@ -172,7 +172,7 @@ private:
ElapsedTimer time;
- int lastTick;
+ qint64 lastTick;
int timingInterval;
int currentAnimationIdx;
bool consistentTiming;