diff options
author | Leonardo Sobral Cunha <leo.cunha@nokia.com> | 2009-10-21 09:04:32 (GMT) |
---|---|---|
committer | Leonardo Sobral Cunha <leo.cunha@nokia.com> | 2009-10-21 09:23:52 (GMT) |
commit | 140d5af0f8635397c48f160bb8a33861b332c171 (patch) | |
tree | 10ece3ea5b7368ecd91b3af07c2731cc5a059288 | |
parent | 5bbb23c6e2858d01716abe27e93e91d466b00d41 (diff) | |
download | Qt-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
-rw-r--r-- | src/gui/animation/qguivariantanimation.cpp | 8 |
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) |