diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2018-08-24 23:59:45 +0200 |
---|---|---|
committer | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2018-08-24 23:59:46 +0200 |
commit | 1d077120f48cc1ad10fc31c2381b0b65a085c217 (patch) | |
tree | f815cd94a96aa006d9fb38ee70958691ad6c2155 /src/corelib/animation | |
parent | 7af0ea5b0f883415927727c8ed10bb6256d1f12d (diff) | |
parent | bd42e2f0cebb2fe8de77a054e9d30aa803749a61 (diff) |
Merge remote-tracking branch 'origin/5.11' into 5.12
Change-Id: I5f1567c792992fc00f0256f39b76cfbe017e6a3a
Diffstat (limited to 'src/corelib/animation')
-rw-r--r-- | src/corelib/animation/qvariantanimation_p.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/corelib/animation/qvariantanimation_p.h b/src/corelib/animation/qvariantanimation_p.h index 37318a5339..9f0f2e3030 100644 --- a/src/corelib/animation/qvariantanimation_p.h +++ b/src/corelib/animation/qvariantanimation_p.h @@ -58,6 +58,8 @@ #include "private/qabstractanimation_p.h" +#include <type_traits> + #ifndef QT_NO_ANIMATION QT_BEGIN_NAMESPACE @@ -104,7 +106,17 @@ public: }; //this should make the interpolation faster -template<typename T> inline T _q_interpolate(const T &f, const T &t, qreal progress) +template<typename T> +typename std::enable_if<std::is_unsigned<T>::value, T>::type +_q_interpolate(const T &f, const T &t, qreal progress) +{ + return T(f + t * progress - f * progress); +} + +// the below will apply also to all non-arithmetic types +template<typename T> +typename std::enable_if<!std::is_unsigned<T>::value, T>::type +_q_interpolate(const T &f, const T &t, qreal progress) { return T(f + (t - f) * progress); } |