aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkMathPriv.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/SkMathPriv.h')
-rw-r--r--src/core/SkMathPriv.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/core/SkMathPriv.h b/src/core/SkMathPriv.h
index b9184a0726..6cca44e958 100644
--- a/src/core/SkMathPriv.h
+++ b/src/core/SkMathPriv.h
@@ -78,4 +78,8 @@ static inline unsigned SkDiv255Round(unsigned prod) {
return (prod + (prod >> 8)) >> 8;
}
+static inline float SkPinToUnitFloat(float x) {
+ return SkTMin(SkTMax(x, 0.0f), 1.0f);
+}
+
#endif