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>
This commit is contained in:
Michael Brasser 2014-08-21 12:05:29 -05:00
parent 2a56a3bad7
commit 970390e114

View File

@ -392,23 +392,18 @@ void QUnifiedTimer::startTimers()
{ {
startTimersPending = false; 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 //we transfer the waiting animations into the "really running" state
animationTimers += animationTimersToStart; animationTimers += animationTimersToStart;
animationTimersToStart.clear(); animationTimersToStart.clear();
if (!animationTimers.isEmpty()) if (!animationTimers.isEmpty()) {
if (!time.isValid()) {
lastTick = 0;
time.start();
temporalDrift = 0;
driverStartTime = 0;
}
localRestart(); localRestart();
}
} }
void QUnifiedTimer::stopTimer() void QUnifiedTimer::stopTimer()
@ -642,11 +637,12 @@ void QAnimationTimer::restartAnimationTimer()
void QAnimationTimer::startAnimations() void QAnimationTimer::startAnimations()
{ {
if (!startAnimationPending)
return;
startAnimationPending = false; startAnimationPending = false;
//force timer to update, which prevents large deltas for our newly added animations //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 //we transfer the waiting animations into the "really running" state
animations += animationsToStart; animations += animationsToStart;
@ -658,7 +654,8 @@ void QAnimationTimer::startAnimations()
void QAnimationTimer::stopTimer() void QAnimationTimer::stopTimer()
{ {
stopTimerPending = false; stopTimerPending = false;
if (animations.isEmpty()) { bool pendingStart = startAnimationPending && animationsToStart.size() > 0;
if (animations.isEmpty() && !pendingStart) {
QUnifiedTimer::resumeAnimationTimer(this); QUnifiedTimer::resumeAnimationTimer(this);
QUnifiedTimer::stopAnimationTimer(this); QUnifiedTimer::stopAnimationTimer(this);
// invalidate the start reference time // invalidate the start reference time