Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Unified Diff: include/core/SkPostConfig.h

Issue 12771010: Add a macro for querying the byte order of SkPMColor. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | include/gpu/GrTypes.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkPostConfig.h
===================================================================
--- include/core/SkPostConfig.h (revision 8061)
+++ include/core/SkPostConfig.h (working copy)
@@ -187,6 +187,26 @@
#endif
#endif
+/**
+ * SK_PM_BYTE_ORDER_IS can be used to query the byte order of SkPMColor at compile time. E.g.:
+ * #if SK_PM_BYTE_ORDER_IS(B, G, R, A)
epoger 2013/03/11 17:26:32 Clever!!! Very nice.
+ * SkDebugf("GDI-compatible SkPMColor");
+ * #endif
+ */
+#ifdef SK_CPU_BENDIAN
+ #define SK_PM_BYTE_ORDER_IS(C0, C1, C2, C3) \
+ (SK_ ## C3 ## 32_SHIFT == 0 && \
+ SK_ ## C2 ## 32_SHIFT == 8 && \
+ SK_ ## C1 ## 32_SHIFT == 16 && \
+ SK_ ## C0 ## 32_SHIFT == 24)
+#else
+ #define SK_PM_BYTE_ORDER_IS(C0, C1, C2, C3) \
+ (SK_ ## C0 ## 32_SHIFT == 0 && \
+ SK_ ## C1 ## 32_SHIFT == 8 && \
+ SK_ ## C2 ## 32_SHIFT == 16 && \
+ SK_ ## C3 ## 32_SHIFT == 24)
+#endif
+
// stdlib macros
#if 0
« no previous file with comments | « no previous file | include/gpu/GrTypes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698