aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core/SkMath.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/core/SkMath.h')
-rw-r--r--include/core/SkMath.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/core/SkMath.h b/include/core/SkMath.h
index 0c89065855..9198412634 100644
--- a/include/core/SkMath.h
+++ b/include/core/SkMath.h
@@ -217,5 +217,12 @@ static inline unsigned SkMul16ShiftRound(unsigned a, unsigned b, int shift) {
return (prod + (prod >> shift)) >> shift;
}
+/** Just the rounding step in SkDiv255Round: round(value / 255)
+ */
+static inline unsigned SkDiv255Round(unsigned prod) {
+ prod += 128;
+ return (prod + (prod >> 8)) >> 8;
+}
+
#endif