aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core/SkColorPriv.h
diff options
context:
space:
mode:
authorGravatar Cary Clark <caryclark@skia.org>2017-09-15 12:49:55 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-09-15 16:59:34 +0000
commit03721621c8567185c6bd36a242028be9d1945cb4 (patch)
tree056c4b2fce9ded4c7b2053a23b54aed686d42c4a /include/core/SkColorPriv.h
parent03168b8a62a0d3d14b7a0d14642df4d82203b87c (diff)
fix flutter and pdfium
missed a couple of users of SkColorPriv.h; restored those functions TBR=reed@google.com NOTRY=true Bug: skia: 6898 Change-Id: I64fc62905be0627c4ecdc39595bd0aaf1f60c5ac Reviewed-on: https://skia-review.googlesource.com/47081 Commit-Queue: Cary Clark <caryclark@skia.org> Reviewed-by: Cary Clark <caryclark@skia.org>
Diffstat (limited to 'include/core/SkColorPriv.h')
-rw-r--r--include/core/SkColorPriv.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/core/SkColorPriv.h b/include/core/SkColorPriv.h
index 8ec4541754..bc8d3004e7 100644
--- a/include/core/SkColorPriv.h
+++ b/include/core/SkColorPriv.h
@@ -21,6 +21,15 @@ static inline unsigned SkAlpha255To256(U8CPU alpha) {
return alpha + 1;
}
+/** Multiplify value by 0..256, and shift the result down 8
+ (i.e. return (value * alpha256) >> 8)
+ */
+#define SkAlphaMul(value, alpha256) (((value) * (alpha256)) >> 8)
+
+static inline U8CPU SkUnitScalarClampToByte(SkScalar x) {
+ return static_cast<U8CPU>(SkScalarPin(x, 0, 1) * 255 + 0.5);
+}
+
#define SK_A32_BITS 8
#define SK_A32_MASK ((1 << SK_A32_BITS) - 1)