diff options
author | Michael Brasser <michael.brasser@live.com> | 2014-08-21 12:05:29 -0500 |
---|---|---|
committer | Michael Brasser <michael.brasser@live.com> | 2014-08-22 18:59:09 +0200 |
commit | 970390e11418647efd420001cdabea67ba0c575f (patch) | |
tree | 6134ce05f08ca31bac4f025641d6364f4750b796 /src/corelib | |
parent | 2a56a3bad75c0cc5befa1ce874995570e622cffc (diff) |
Incorporate fixes from QQmlAnimationTimer into QAnimationTimer.
Incorporates animation timer fixes in:
* 7da483bfbefcaabb1dbbf3e2f1d5b5f7aadc3b06
* b02eeeee586abe343b8866385c1327ac009b3ef0
* 59d5c5cf555a51cd7559cea197a198ef3a792614
from qtdeclarative.
With these changes, we no longer need to call updateAnimationTimers
in QUnifiedTimer::startTimers.
Change-Id: Ic24501cfdc3cb572bd891d84f684f11c3bef1b50
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/animation/qabstractanimation.cpp | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp index 8263e056fb..28a09ee2e4 100644 --- a/src/corelib/animation/qabstractanimation.cpp +++ b/src/corelib/animation/qabstractanimation.cpp @@ -392,23 +392,18 @@ void QUnifiedTimer::startTimers() { startTimersPending = false; - // Initialize the wall clock right away as we need this for - // both localRestart and updateAnimationTimers() down below.. - if (!time.isValid()) { - lastTick = 0; - time.start(); - temporalDrift = 0; - driverStartTime = 0; - } - - if (!animationTimers.isEmpty()) - updateAnimationTimers(-1); - //we transfer the waiting animations into the "really running" state animationTimers += animationTimersToStart; animationTimersToStart.clear(); - if (!animationTimers.isEmpty()) + if (!animationTimers.isEmpty()) { + if (!time.isValid()) { + lastTick = 0; + time.start(); + temporalDrift = 0; + driverStartTime = 0; + } localRestart(); + } } void QUnifiedTimer::stopTimer() @@ -642,11 +637,12 @@ void QAnimationTimer::restartAnimationTimer() void QAnimationTimer::startAnimations() { + if (!startAnimationPending) + return; startAnimationPending = false; //force timer to update, which prevents large deltas for our newly added animations - if (!animations.isEmpty()) - QUnifiedTimer::instance()->maybeUpdateAnimationsToCurrentTime(); + QUnifiedTimer::instance()->maybeUpdateAnimationsToCurrentTime(); //we transfer the waiting animations into the "really running" state animations += animationsToStart; @@ -658,7 +654,8 @@ void QAnimationTimer::startAnimations() void QAnimationTimer::stopTimer() { stopTimerPending = false; - if (animations.isEmpty()) { + bool pendingStart = startAnimationPending && animationsToStart.size() > 0; + if (animations.isEmpty() && !pendingStart) { QUnifiedTimer::resumeAnimationTimer(this); QUnifiedTimer::stopAnimationTimer(this); // invalidate the start reference time |