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

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_PMCOLOR_BYTE_ORDER can be used to query the byte order of SkPMColor at com pile time. The
192 * relationship between the byte order and shift values depends on machine endia nness. If the shift
193 * order is R=0, G=8, B=16, A=24 then ((char*)&pmcolor)[0] will produce the R ch annel on a little
194 * endian machine and the A channel on a big endian machine. Thus, given those s hifts values,
195 * SK_PMCOLOR_BYTE_ORDER(R,G,B,A) will be true on a little endian machine and
196 * SK_PMCOLOR_BYTE_ORDER(A,B,G,R) will be true on a big endian machine.
197 */
198 #ifdef SK_CPU_BENDIAN
199 #define SK_PMCOLOR_BYTE_ORDER(C0, C1, C2, C3) \
200 (SK_ ## C3 ## 32_SHIFT == 0 && \
201 SK_ ## C2 ## 32_SHIFT == 8 && \
202 SK_ ## C1 ## 32_SHIFT == 16 && \
203 SK_ ## C0 ## 32_SHIFT == 24)
204 #else
205 #define SK_PMCOLOR_BYTE_ORDER(C0, C1, C2, C3) \
206 (SK_ ## C0 ## 32_SHIFT == 0 && \
207 SK_ ## C1 ## 32_SHIFT == 8 && \
208 SK_ ## C2 ## 32_SHIFT == 16 && \
209 SK_ ## C3 ## 32_SHIFT == 24)
210 #endif
211
190 // stdlib macros 212 // stdlib macros
191 213
192 #if 0 214 #if 0
193 #if !defined(strlen) && defined(SK_DEBUG) 215 #if !defined(strlen) && defined(SK_DEBUG)
194 extern size_t sk_strlen(const char*); 216 extern size_t sk_strlen(const char*);
195 #define strlen(s) sk_strlen(s) 217 #define strlen(s) sk_strlen(s)
196 #endif 218 #endif
197 #ifndef sk_strcpy 219 #ifndef sk_strcpy
198 #define sk_strcpy(dst, src) strcpy(dst, src) 220 #define sk_strcpy(dst, src) strcpy(dst, src)
199 #endif 221 #endif
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 #else 354 #else
333 #define SK_SIZE_T_SPECIFIER "%zu" 355 #define SK_SIZE_T_SPECIFIER "%zu"
334 #endif 356 #endif
335 #endif 357 #endif
336 358
337 ////////////////////////////////////////////////////////////////////// 359 //////////////////////////////////////////////////////////////////////
338 360
339 #ifndef SK_ALLOW_STATIC_GLOBAL_INITIALIZERS 361 #ifndef SK_ALLOW_STATIC_GLOBAL_INITIALIZERS
340 #define SK_ALLOW_STATIC_GLOBAL_INITIALIZERS 1 362 #define SK_ALLOW_STATIC_GLOBAL_INITIALIZERS 1
341 #endif 363 #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