summaryrefslogtreecommitdiffstats
path: root/src/gui/animation
diff options
context:
space:
mode:
authorLeonardo Sobral Cunha <leo.cunha@nokia.com>2009-10-21 11:04:32 +0200
committerLeonardo Sobral Cunha <leo.cunha@nokia.com>2009-10-21 11:23:52 +0200
commit140d5af0f8635397c48f160bb8a33861b332c171 (patch)
tree10ece3ea5b7368ecd91b3af07c2731cc5a059288 /src/gui/animation
parent5bbb23c6e2858d01716abe27e93e91d466b00d41 (diff)
Clips color interpolation to range [0, 255]
This avoid warnings when using easing curves that progress outside the range [0.0, 1.0]. Patch proposed by warwick. Reviewed-by: Warwick Allison
Diffstat (limited to 'src/gui/animation')
-rw-r--r--src/gui/animation/qguivariantanimation.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/gui/animation/qguivariantanimation.cpp b/src/gui/animation/qguivariantanimation.cpp
index 0ae79b6a0e..1e9c166b2a 100644
--- a/src/gui/animation/qguivariantanimation.cpp
+++ b/src/gui/animation/qguivariantanimation.cpp
@@ -54,10 +54,10 @@ QT_BEGIN_NAMESPACE
template<> Q_INLINE_TEMPLATE QColor _q_interpolate(const QColor &f,const QColor &t, qreal progress)
{
- return QColor(_q_interpolate(f.red(), t.red(), progress),
- _q_interpolate(f.green(), t.green(), progress),
- _q_interpolate(f.blue(), t.blue(), progress),
- _q_interpolate(f.alpha(), t.alpha(), progress));
+ return QColor(qBound(0,_q_interpolate(f.red(), t.red(), progress),255),
+ qBound(0,_q_interpolate(f.green(), t.green(), progress),255),
+ qBound(0,_q_interpolate(f.blue(), t.blue(), progress),255),
+ qBound(0,_q_interpolate(f.alpha(), t.alpha(), progress),255));
}
template<> Q_INLINE_TEMPLATE QQuaternion _q_interpolate(const QQuaternion &f,const QQuaternion &t, qreal progress)