aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar djsollen@google.com <djsollen@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-08-20 20:28:03 +0000
committerGravatar djsollen@google.com <djsollen@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-08-20 20:28:03 +0000
commit2b343cc2557aa7921fa8b04bf6800ebf37af186b (patch)
tree75b7dfa6d6a2de0d3b141b7def078151348244e9
parent6364b5edc3adb4ec0b26e507a474a2066977c509 (diff)
create a macro for testing if skcolor and skpmcolor have same shift values
R=reed@google.com Review URL: https://codereview.chromium.org/22799015 git-svn-id: http://skia.googlecode.com/svn/trunk@10838 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r--include/core/SkPostConfig.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/core/SkPostConfig.h b/include/core/SkPostConfig.h
index 4a819d369a..0c2358aeb8 100644
--- a/include/core/SkPostConfig.h
+++ b/include/core/SkPostConfig.h
@@ -207,6 +207,14 @@
#endif
/**
+ * SkColor has well defined shift values, but SkPMColor is configurable. This
+ * macro is a convenience that returns true if the shift values are equal while
+ * ignoring the machine's endianness.
+ */
+#define SK_COLOR_MATCHES_PMCOLOR_BYTE_ORDER \
+ (SK_A32_SHIFT == 24 && SK_R32_SHIFT == 16 && SK_G32_SHIFT == 8 && SK_B32_SHIFT == 0)
+
+/**
* SK_PMCOLOR_BYTE_ORDER can be used to query the byte order of SkPMColor at compile time. The
* relationship between the byte order and shift values depends on machine endianness. If the shift
* order is R=0, G=8, B=16, A=24 then ((char*)&pmcolor)[0] will produce the R channel on a little