Avoid double call for QEasingCurve's valueForProgress() (now executed by EasingAnimation before calling updateEffectiveTime), causing a minor corruption of the effective animation progress values.

svn path=/trunk/KDE/kdelibs/; revision=1117762
This commit is contained in:
Bruno de Oliveira Abinader 2010-04-22 23:10:29 +00:00
parent d54fd38d3b
commit 75b66bdd8b
8 changed files with 8 additions and 18 deletions

View File

@ -76,8 +76,7 @@ void FadeAnimation::updateEffectiveTime(int currentTime)
QGraphicsWidget *w = targetWidget();
if (w) {
qreal delta = currentTime / qreal(duration());
delta = (m_startOpacity - m_targetOpacity) *
Animation::easingCurve().valueForProgress(delta);
delta *= m_startOpacity - m_targetOpacity;
w->setOpacity(m_startOpacity - delta);
}
}

View File

@ -78,8 +78,7 @@ void GeometryAnimation::updateEffectiveTime(int currentTime)
{
QGraphicsWidget *w = targetWidget();
if (w) {
qreal delta = Animation::easingCurve().valueForProgress(
currentTime / qreal(duration()));
const qreal delta = currentTime / qreal(duration());
QRectF newGeo = m_startGeometry;
newGeo.adjust((-m_startGeometry.x() + m_targetGeometry.x()) * delta,

View File

@ -44,8 +44,7 @@ void GrowAnimation::updateEffectiveTime(int currentTime)
{
QGraphicsWidget *w = targetWidget();
if (w && state() == QAbstractAnimation::Running) {
qreal delta = Animation::easingCurve().valueForProgress(
currentTime / qreal(duration()));
const qreal delta = currentTime / qreal(duration());
QRectF geometry;
geometry.setTopLeft(m_startGeometry.topLeft() * (1-delta) + (m_targetGeometry.topLeft() * delta));
geometry.setSize(m_startGeometry.size() * (1-delta) + (m_targetGeometry.size() * delta));

View File

@ -133,7 +133,6 @@ void PixmapTransition::updateEffectiveTime(int currentTime)
QGraphicsWidget *w = targetWidget();
if (w) {
qreal delta = currentTime / qreal(duration());
delta *= Animation::easingCurve().valueForProgress(delta);
if (!m_startPixmap.isNull() && !m_targetPixmap.isNull()) {
m_currentPixmap = Plasma::PaintUtils::transition(m_startPixmap, m_targetPixmap, delta);
} else if (m_startPixmap.isNull()) {

View File

@ -119,11 +119,10 @@ void PulseAnimation::updateState(QAbstractAnimation::State newState, QAbstractAn
void PulseAnimation::updateEffectiveTime(int currentTime)
{
if (m_under.data()) {
qreal delta = Animation::easingCurve().valueForProgress( currentTime / qreal(duration()));
qreal delta = currentTime / qreal(duration());
if (m_under.data()->isIconBigger()) {
m_under.data()->setScale(delta);
} else {
m_under.data()->setScale(delta);
delta = (1 - m_endScale) * delta;

View File

@ -161,11 +161,8 @@ void RotationAnimation::updateState(QAbstractAnimation::State newState, QAbstrac
void RotationAnimation::updateEffectiveTime(int currentTime)
{
QGraphicsWidget *w = targetWidget();
if (w) {
qreal delta = Animation::easingCurve().valueForProgress(
currentTime / qreal(duration()));
delta = angle() * delta;
if (targetWidget()) {
qreal delta = currentTime * angle() / qreal(duration());
m_rotation->setAngle(delta);
}
}

View File

@ -72,8 +72,7 @@ void SlideAnimation::updateEffectiveTime(int currentTime)
{
QGraphicsWidget *w = targetWidget();
if (w && state() == QAbstractAnimation::Running) {
qreal delta = Animation::easingCurve().valueForProgress(
currentTime / qreal(duration()));
const qreal delta = currentTime / qreal(duration());
w->setPos(m_startPos * (1-delta) + (m_targetPos * delta));
}
}

View File

@ -64,8 +64,7 @@ void ZoomAnimation::updateEffectiveTime(int currentTime)
{
QGraphicsWidget *w = targetWidget();
if (w) {
qreal delta = Animation::easingCurve().valueForProgress(
currentTime / qreal(duration()));
qreal delta = currentTime / qreal(duration());
if (m_zoom != 1) {
delta = (1 - m_zoom) * delta;
w->setScale(1 - delta);