diff options
Diffstat (limited to 'libs/hwui/utils')
-rw-r--r-- | libs/hwui/utils/MathUtils.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libs/hwui/utils/MathUtils.h b/libs/hwui/utils/MathUtils.h index 00448b8..d89859b 100644 --- a/libs/hwui/utils/MathUtils.h +++ b/libs/hwui/utils/MathUtils.h @@ -76,6 +76,11 @@ public: return a < b ? a : b; } + template<typename T> + static inline T clamp(T a, T minValue, T maxValue) { + return min(max(a, minValue), maxValue); + } + inline static float lerp(float v1, float v2, float t) { return v1 + ((v2 - v1) * t); } |