aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/util/qquickanimatorjob.cpp
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar.sletta@digia.com>2013-10-04 15:42:35 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-10-08 08:02:21 +0200
commitaeb8416d948b69d55dda45ed4ebe85585325fedc (patch)
tree47590a9df24e66f67719a5f74a4710b8418efd4c /src/quick/util/qquickanimatorjob.cpp
parent29e3d02c26d264adb2b581b3511d29efb124f331 (diff)
Several smaller fixes to Animators.
Backwards animations are not supported for animators as the animation system cannot handle uncontrolled backwards animations. Make sure we write back values only for the animators that have run at all. Clockwise rotation to 0 can easily end up on 360 as a result the _q_interpolateClockwise function not being entirely correct. Change-Id: If69b8555a1361f46600a40e80419b65438c18097 Reviewed-by: Michael Brasser <michael.brasser@live.com>
Diffstat (limited to 'src/quick/util/qquickanimatorjob.cpp')
-rw-r--r--src/quick/util/qquickanimatorjob.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/quick/util/qquickanimatorjob.cpp b/src/quick/util/qquickanimatorjob.cpp
index 389ef23b2e..78708bdf81 100644
--- a/src/quick/util/qquickanimatorjob.cpp
+++ b/src/quick/util/qquickanimatorjob.cpp
@@ -204,7 +204,8 @@ static void qquick_syncback_helper(QAbstractAnimationJob *job)
{
if (job->isRenderThreadJob()) {
QQuickAnimatorJob *a = static_cast<QQuickAnimatorJob *>(job);
- if (a->controller())
+ // Sync back only those jobs that actually have been running
+ if (a->controller() && a->hasBeenRunning())
a->writeBack();
} else if (job->isGroup()) {
QAnimationGroupJob *g = static_cast<QAnimationGroupJob *>(job);
@@ -227,6 +228,7 @@ QQuickAnimatorJob::QQuickAnimatorJob()
, m_duration(0)
, m_isTransform(false)
, m_isUniform(false)
+ , m_hasBeenRunning(false)
{
m_isRenderThreadJob = true;
}
@@ -265,6 +267,7 @@ void QQuickAnimatorJob::updateState(State newState, State oldState)
if (newState == Running) {
m_controller->activeLeafAnimations << this;
+ m_hasBeenRunning = true;
} else if (oldState == Running) {
m_controller->activeLeafAnimations.remove(this);
}
@@ -297,6 +300,8 @@ void QQuickTransformAnimatorJob::initialize(QQuickAnimatorController *controller
QObject::connect(m_target, SIGNAL(destroyed(QObject *)), m_controller, SLOT(itemDestroyed(QObject*)), Qt::DirectConnection);
} else {
++m_helper->ref;
+ // Make sure leftovers from previous runs are being used...
+ m_helper->wasSynced = false;
}
m_helper->sync();
}
@@ -489,6 +494,11 @@ void QQuickRotationAnimatorJob::updateCurrentTime(int time)
switch (m_direction) {
case QQuickRotationAnimator::Clockwise:
m_value = _q_interpolateClockwiseRotation(m_from, m_to, t).toFloat();
+ // The logic in _q_interpolateClockwise comes out a bit wrong
+ // for the case of X->0 where 0<X<360. It ends on 360 which it
+ // shouldn't.
+ if (t == 1)
+ m_value = m_to;
break;
case QQuickRotationAnimator::Counterclockwise:
m_value = _q_interpolateCounterclockwiseRotation(m_from, m_to, t).toFloat();