summaryrefslogtreecommitdiffstats
path: root/src/gui/animation/qguivariantanimation.cpp
diff options
context:
space:
mode:
authorLeonardo Sobral Cunha <leo.cunha@nokia.com>2009-10-21 09:04:32 (GMT)
committerLeonardo Sobral Cunha <leo.cunha@nokia.com>2009-10-21 09:23:52 (GMT)
commit140d5af0f8635397c48f160bb8a33861b332c171 (patch)
tree10ece3ea5b7368ecd91b3af07c2731cc5a059288 /src/gui/animation/qguivariantanimation.cpp
parent5bbb23c6e2858d01716abe27e93e91d466b00d41 (diff)
downloadQt-140d5af0f8635397c48f160bb8a33861b332c171.zip
Qt-140d5af0f8635397c48f160bb8a33861b332c171.tar.gz
Qt-140d5af0f8635397c48f160bb8a33861b332c171.tar.bz2
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/qguivariantanimation.cpp')
-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 0ae79b6..1e9c166 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)