From aa92d2dbd963432277887ac8e0f0c1e563212ec8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Mon, 3 Jun 2013 08:58:54 +0200 Subject: [PATCH] No repaints for keepAtTarget and before started Do not schedule repaints in AnimationEffect if there are no animations going on. If an animation is waiting for starting or kept after ending the visual appearance is no longer changed, so no repaint is needed. REVIEW: 110795 --- libkwineffects/kwinanimationeffect.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/libkwineffects/kwinanimationeffect.cpp b/libkwineffects/kwinanimationeffect.cpp index b74df42f56..17973870ef 100644 --- a/libkwineffects/kwinanimationeffect.cpp +++ b/libkwineffects/kwinanimationeffect.cpp @@ -574,7 +574,19 @@ void AnimationEffect::postPaintScreen() } else { AniMap::const_iterator it = d->m_animations.constBegin(), end = d->m_animations.constEnd(); for (; it != end; ++it) { - it.key()->addLayerRepaint(it->second); + bool addRepaint = false; + QList::const_iterator anim = it->first.constBegin(); + for (; anim != it->first.constEnd(); ++anim) { + if (anim->startTime > clock()) + continue; + if (anim->time < anim->duration) { + addRepaint = true; + break; + } + } + if (addRepaint) { + it.key()->addLayerRepaint(it->second); + } } } } @@ -670,8 +682,9 @@ void AnimationEffect::triggerRepaint() effects->addRepaintFull(); } else { AniMap::const_iterator it = d->m_animations.constBegin(), end = d->m_animations.constEnd(); - for (; it != end; ++it) + for (; it != end; ++it) { it.key()->addLayerRepaint(it->second); + } } }