aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkMathPriv.h
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2016-01-21 15:29:10 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-01-21 15:29:10 -0800
commit353c148d8e8c9031daca34c6f9d6bcc6f08706c7 (patch)
tree2688f89d13fd991cefaf2a6e9cd79e48fa31417c /src/core/SkMathPriv.h
parent07caf56e723ec04a024f952177f7f4daba06c82c (diff)
experiment: float color components
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