OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006 The Android Open Source Project | 2 * Copyright (C) 2006 The Android Open Source Project |
3 * | 3 * |
4 * Licensed under the Apache License, Version 2.0 (the "License"); | 4 * Licensed under the Apache License, Version 2.0 (the "License"); |
5 * you may not use this file except in compliance with the License. | 5 * you may not use this file except in compliance with the License. |
6 * You may obtain a copy of the License at | 6 * You may obtain a copy of the License at |
7 * | 7 * |
8 * http://www.apache.org/licenses/LICENSE-2.0 | 8 * http://www.apache.org/licenses/LICENSE-2.0 |
9 * | 9 * |
10 * Unless required by applicable law or agreed to in writing, software | 10 * Unless required by applicable law or agreed to in writing, software |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 void SkDebugf_FileLine(const char* file, int line, bool fatal, | 131 void SkDebugf_FileLine(const char* file, int line, bool fatal, |
132 const char* format, ...); | 132 const char* format, ...); |
133 | 133 |
134 // Marking the debug print as "fatal" will cause a debug break, so we don't need | 134 // Marking the debug print as "fatal" will cause a debug break, so we don't need |
135 // a separate crash call here. | 135 // a separate crash call here. |
136 #define SK_DEBUGBREAK(cond) do { if (!(cond)) { \ | 136 #define SK_DEBUGBREAK(cond) do { if (!(cond)) { \ |
137 SkDebugf_FileLine(__FILE__, __LINE__, true, \ | 137 SkDebugf_FileLine(__FILE__, __LINE__, true, \ |
138 "%s:%d: failed assertion \"%s\"\n", \ | 138 "%s:%d: failed assertion \"%s\"\n", \ |
139 __FILE__, __LINE__, #cond); } } while (false) | 139 __FILE__, __LINE__, #cond); } } while (false) |
140 | 140 |
| 141 // All little-endian Chrome platforms agree: BGRA is the optimal pixel layout. |
| 142 #define SK_A32_SHIFT 24 |
| 143 #define SK_R32_SHIFT 16 |
| 144 #define SK_G32_SHIFT 8 |
| 145 #define SK_B32_SHIFT 0 |
| 146 |
141 #if defined(SK_BUILD_FOR_WIN32) | 147 #if defined(SK_BUILD_FOR_WIN32) |
142 | 148 |
143 #define SK_BUILD_FOR_WIN | 149 #define SK_BUILD_FOR_WIN |
144 | 150 |
145 // VC8 doesn't support stdint.h, so we define those types here. | 151 // VC8 doesn't support stdint.h, so we define those types here. |
146 #define SK_IGNORE_STDINT_DOT_H | 152 #define SK_IGNORE_STDINT_DOT_H |
147 typedef signed char int8_t; | 153 typedef signed char int8_t; |
148 typedef unsigned char uint8_t; | 154 typedef unsigned char uint8_t; |
149 typedef short int16_t; | 155 typedef short int16_t; |
150 typedef unsigned short uint16_t; | 156 typedef unsigned short uint16_t; |
151 typedef int int32_t; | 157 typedef int int32_t; |
152 typedef unsigned uint32_t; | 158 typedef unsigned uint32_t; |
153 #define SK_A32_SHIFT 24 | |
154 #define SK_R32_SHIFT 16 | |
155 #define SK_G32_SHIFT 8 | |
156 #define SK_B32_SHIFT 0 | |
157 | 159 |
158 // VC doesn't support __restrict__, so make it a NOP. | 160 // VC doesn't support __restrict__, so make it a NOP. |
159 #undef SK_RESTRICT | 161 #undef SK_RESTRICT |
160 #define SK_RESTRICT | 162 #define SK_RESTRICT |
161 | 163 |
162 // Skia uses this deprecated bzero function to fill zeros into a string. | 164 // Skia uses this deprecated bzero function to fill zeros into a string. |
163 #define bzero(str, len) memset(str, 0, len) | 165 #define bzero(str, len) memset(str, 0, len) |
164 | 166 |
165 #elif defined(SK_BUILD_FOR_MAC) | 167 #elif defined(SK_BUILD_FOR_MAC) |
166 | 168 |
167 #define SK_CPU_LENDIAN | 169 #define SK_CPU_LENDIAN |
168 #undef SK_CPU_BENDIAN | 170 #undef SK_CPU_BENDIAN |
169 // we want (memory order) BGRA, because that's what core image uses with | |
170 // kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host, which is what | |
171 // Apple recommends for best performance (ARGB becomes BGRA in memory on | |
172 // little-endian) -- and we want skia and coregraphic to have matching memory | |
173 // layouts, so that we don't have to spend time converting between them. | |
174 #define SK_A32_SHIFT 24 | |
175 #define SK_R32_SHIFT 16 | |
176 #define SK_G32_SHIFT 8 | |
177 #define SK_B32_SHIFT 0 | |
178 | 171 |
179 #elif defined(SK_BUILD_FOR_UNIX) | 172 #elif defined(SK_BUILD_FOR_UNIX) |
180 | 173 |
181 #ifdef SK_CPU_BENDIAN | 174 #ifdef SK_CPU_BENDIAN |
182 // Below we set the order for ARGB channels in registers. I suspect that, on | 175 // Above we set the order for ARGB channels in registers. I suspect that, on |
183 // big endian machines, you can keep this the same and everything will work. | 176 // big endian machines, you can keep this the same and everything will work. |
184 // The in-memory order will be different, of course, but as long as everything | 177 // The in-memory order will be different, of course, but as long as everything |
185 // is reading memory as words rather than bytes, it will all work. However, if | 178 // is reading memory as words rather than bytes, it will all work. However, if |
186 // you find that colours are messed up I thought that I would leave a helpful | 179 // you find that colours are messed up I thought that I would leave a helpful |
187 // locator for you. Also see the comments in | 180 // locator for you. Also see the comments in |
188 // base/gfx/bitmap_platform_device_linux.h | 181 // base/gfx/bitmap_platform_device_linux.h |
189 #error Read the comment at this location | 182 #error Read the comment at this location |
190 #endif | 183 #endif |
191 | 184 |
192 // For Linux we want to match the most common X visual, which is | |
193 // ARGB (in registers) | |
194 #define SK_A32_SHIFT 24 | |
195 #define SK_R32_SHIFT 16 | |
196 #define SK_G32_SHIFT 8 | |
197 #define SK_B32_SHIFT 0 | |
198 | |
199 #endif | 185 #endif |
200 | 186 |
201 // The default crash macro writes to badbeef which can cause some strange | 187 // The default crash macro writes to badbeef which can cause some strange |
202 // problems. Instead, pipe this through to the logging function as a fatal | 188 // problems. Instead, pipe this through to the logging function as a fatal |
203 // assertion. | 189 // assertion. |
204 #define SK_CRASH() SkDebugf_FileLine(__FILE__, __LINE__, true, "SK_CRASH") | 190 #define SK_CRASH() SkDebugf_FileLine(__FILE__, __LINE__, true, "SK_CRASH") |
205 | 191 |
| 192 // Enable the use of the SkEdgeBuilder class. |
| 193 #define USE_NEW_BUILDER 1 |
| 194 |
206 // ===== End Chrome-specific definitions ===== | 195 // ===== End Chrome-specific definitions ===== |
207 | 196 |
208 #endif | 197 #endif |
OLD | NEW |