diff options
author | Thierry Bastian <thierry.bastian@nokia.com> | 2009-10-21 08:15:19 (GMT) |
---|---|---|
committer | Thierry Bastian <thierry.bastian@nokia.com> | 2009-10-21 08:17:25 (GMT) |
commit | 619d049371ac8a180de3d91140bf252f44c25dad (patch) | |
tree | 515ec155d2778f41e8de77377fa8b717addc3255 /src/corelib/animation | |
parent | ed2ff6553ec481bd489df096d5ec1cdb545ebb33 (diff) | |
download | Qt-619d049371ac8a180de3d91140bf252f44c25dad.zip Qt-619d049371ac8a180de3d91140bf252f44c25dad.tar.gz Qt-619d049371ac8a180de3d91140bf252f44c25dad.tar.bz2 |
Improve performance when starting a lot of animations
We avoid stopping/starting the timer over and over again
Patch suggested by Aaron.
Reviewed-by: Aaron Kennedy
Diffstat (limited to 'src/corelib/animation')
-rw-r--r-- | src/corelib/animation/qabstractanimation.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp index 0d5f278..2f776d3 100644 --- a/src/corelib/animation/qabstractanimation.cpp +++ b/src/corelib/animation/qabstractanimation.cpp @@ -272,7 +272,8 @@ void QUnifiedTimer::registerAnimation(QAbstractAnimation *animation, bool isTopL Q_ASSERT(!QAbstractAnimationPrivate::get(animation)->hasRegisteredTimer); QAbstractAnimationPrivate::get(animation)->hasRegisteredTimer = true; animationsToStart << animation; - startStopAnimationTimer.start(STARTSTOP_TIMER_DELAY, this); + if (!startStopAnimationTimer.isActive()) + startStopAnimationTimer.start(STARTSTOP_TIMER_DELAY, this); } } @@ -290,7 +291,7 @@ void QUnifiedTimer::unregisterAnimation(QAbstractAnimation *animation) if (idx <= currentAnimationIdx) --currentAnimationIdx; - if (animations.isEmpty()) + if (animations.isEmpty() && !startStopAnimationTimer.isActive()) startStopAnimationTimer.start(STARTSTOP_TIMER_DELAY, this); } else { animationsToStart.removeOne(animation); |