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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | include/gpu/GrTypes.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #ifndef SkPostConfig_DEFINED 10 #ifndef SkPostConfig_DEFINED
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 #define SK_B32_SHIFT 8 180 #define SK_B32_SHIFT 8
181 #define SK_A32_SHIFT 0 181 #define SK_A32_SHIFT 0
182 #else 182 #else
183 #define SK_R32_SHIFT 0 183 #define SK_R32_SHIFT 0
184 #define SK_G32_SHIFT 8 184 #define SK_G32_SHIFT 8
185 #define SK_B32_SHIFT 16 185 #define SK_B32_SHIFT 16
186 #define SK_A32_SHIFT 24 186 #define SK_A32_SHIFT 24
187 #endif 187 #endif
188 #endif 188 #endif
189 189
190 /**
191 * SK_PM_BYTE_ORDER_IS can be used to query the byte order of SkPMColor at compi le time. E.g.:
192 * #if SK_PM_BYTE_ORDER_IS(B, G, R, A)
epoger 2013/03/11 17:26:32 Clever!!! Very nice.
193 * SkDebugf("GDI-compatible SkPMColor");
194 * #endif
195 */
196 #ifdef SK_CPU_BENDIAN
197 #define SK_PM_BYTE_ORDER_IS(C0, C1, C2, C3) \
198 (SK_ ## C3 ## 32_SHIFT == 0 && \
199 SK_ ## C2 ## 32_SHIFT == 8 && \
200 SK_ ## C1 ## 32_SHIFT == 16 && \
201 SK_ ## C0 ## 32_SHIFT == 24)
202 #else
203 #define SK_PM_BYTE_ORDER_IS(C0, C1, C2, C3) \
204 (SK_ ## C0 ## 32_SHIFT == 0 && \
205 SK_ ## C1 ## 32_SHIFT == 8 && \
206 SK_ ## C2 ## 32_SHIFT == 16 && \
207 SK_ ## C3 ## 32_SHIFT == 24)
208 #endif
209
190 // stdlib macros 210 // stdlib macros
191 211
192 #if 0 212 #if 0
193 #if !defined(strlen) && defined(SK_DEBUG) 213 #if !defined(strlen) && defined(SK_DEBUG)
194 extern size_t sk_strlen(const char*); 214 extern size_t sk_strlen(const char*);
195 #define strlen(s) sk_strlen(s) 215 #define strlen(s) sk_strlen(s)
196 #endif 216 #endif
197 #ifndef sk_strcpy 217 #ifndef sk_strcpy
198 #define sk_strcpy(dst, src) strcpy(dst, src) 218 #define sk_strcpy(dst, src) strcpy(dst, src)
199 #endif 219 #endif
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 #else 352 #else
333 #define SK_SIZE_T_SPECIFIER "%zu" 353 #define SK_SIZE_T_SPECIFIER "%zu"
334 #endif 354 #endif
335 #endif 355 #endif
336 356
337 ////////////////////////////////////////////////////////////////////// 357 //////////////////////////////////////////////////////////////////////
338 358
339 #ifndef SK_ALLOW_STATIC_GLOBAL_INITIALIZERS 359 #ifndef SK_ALLOW_STATIC_GLOBAL_INITIALIZERS
340 #define SK_ALLOW_STATIC_GLOBAL_INITIALIZERS 1 360 #define SK_ALLOW_STATIC_GLOBAL_INITIALIZERS 1
341 #endif 361 #endif
OLDNEW
« 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