aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar Cary Clark <caryclark@skia.org>2017-09-18 10:05:52 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-09-18 14:27:59 +0000
commitfb0fcb2579b420ac136bac434d35e0b38e926c44 (patch)
tree4a3921ad7a82b94be5cd6c078339d6f5eeb1d46c /include
parentdd9468b9600c6f9fb956ce3cc4f684371d54ef2a (diff)
add back missing dependencies in SkColorPriv.h
SkColorPriv.h depends on SkColor.h and SK_RGBA_x32_SHIFT TBR=reed@google.com Bug: skia: 6898 Change-Id: I3f7bbaff306298e89bfb0bb571b19d6d223147e5 Reviewed-on: https://skia-review.googlesource.com/47861 Reviewed-by: Cary Clark <caryclark@skia.org> Commit-Queue: Cary Clark <caryclark@skia.org>
Diffstat (limited to 'include')
-rw-r--r--include/core/SkColorPriv.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/include/core/SkColorPriv.h b/include/core/SkColorPriv.h
index 545421e0e8..077e79cfb5 100644
--- a/include/core/SkColorPriv.h
+++ b/include/core/SkColorPriv.h
@@ -8,6 +8,7 @@
#ifndef SkColorPriv_DEFINED
#define SkColorPriv_DEFINED
+#include "SkColor.h"
#include "SkMath.h"
/** Turn 0..255 into 0..256 by adding 1 at the half-way point. Used to turn a
@@ -42,6 +43,30 @@ static inline U8CPU SkUnitScalarClampToByte(SkScalar x) {
#define SK_G32_MASK ((1 << SK_G32_BITS) - 1)
#define SK_B32_MASK ((1 << SK_B32_BITS) - 1)
+/*
+ * Skia's 32bit backend only supports 1 sizzle order at a time (compile-time).
+ * This is specified by 4 defines SK_A32_SHIFT, SK_R32_SHIFT, ... for G and B.
+ *
+ * For easier compatibility with Skia's GPU backend, we further restrict these
+ * to either (in memory-byte-order) RGBA or BGRA. Note that this "order" does
+ * not directly correspond to the same shift-order, since we have to take endianess
+ * into account.
+ *
+ * Here we enforce this constraint.
+ */
+
+#ifdef SK_CPU_BENDIAN
+ #define SK_RGBA_R32_SHIFT 24
+ #define SK_RGBA_G32_SHIFT 16
+ #define SK_RGBA_B32_SHIFT 8
+ #define SK_RGBA_A32_SHIFT 0
+#else
+ #define SK_RGBA_R32_SHIFT 0
+ #define SK_RGBA_G32_SHIFT 8
+ #define SK_RGBA_B32_SHIFT 16
+ #define SK_RGBA_A32_SHIFT 24
+#endif
+
#define SkGetPackedA32(packed) ((uint32_t)((packed) << (24 - SK_A32_SHIFT)) >> 24)
#define SkGetPackedR32(packed) ((uint32_t)((packed) << (24 - SK_R32_SHIFT)) >> 24)
#define SkGetPackedG32(packed) ((uint32_t)((packed) << (24 - SK_G32_SHIFT)) >> 24)