OLD | NEW |
---|---|
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2010 Google Inc. | 3 * Copyright 2010 Google Inc. |
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 | 10 |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
232 kARGB_GrMaskFormat, //!< 4-bytes per pixel, color format | 232 kARGB_GrMaskFormat, //!< 4-bytes per pixel, color format |
233 | 233 |
234 kLast_GrMaskFormat = kARGB_GrMaskFormat | 234 kLast_GrMaskFormat = kARGB_GrMaskFormat |
235 }; | 235 }; |
236 static const int kMaskFormatCount = kLast_GrMaskFormat + 1; | 236 static const int kMaskFormatCount = kLast_GrMaskFormat + 1; |
237 | 237 |
238 /** | 238 /** |
239 * Return the number of bytes-per-pixel for the specified mask format. | 239 * Return the number of bytes-per-pixel for the specified mask format. |
240 */ | 240 */ |
241 static inline int GrMaskFormatBytesPerPixel(GrMaskFormat format) { | 241 static inline int GrMaskFormatBytesPerPixel(GrMaskFormat format) { |
242 SkASSERT((unsigned)format <= 3); | |
243 // kA8 (0) -> 1 | 242 // kA8 (0) -> 1 |
244 // kA565 (1) -> 2 | 243 // kA565 (1) -> 2 |
robertphillips
2014/11/26 18:19:35
(2) ?
jvanverth1
2014/11/26 19:21:49
Done.
| |
245 // kARGB (3) -> 4 | 244 // kARGB (3) -> 4 |
246 static const int sBytesPerPixel[] = { 1, 2, 4 }; | 245 static const int sBytesPerPixel[] = { 1, 2, 4 }; |
robertphillips
2014/11/26 18:19:35
Why SK_ARRAY_COUNT(sBytesPerPixel) instead of kMas
jvanverth1
2014/11/26 19:21:49
Done.
| |
246 SkASSERT((unsigned)format < SK_ARRAY_COUNT(sBytesPerPixel)); | |
247 SK_COMPILE_ASSERT(SK_ARRAY_COUNT(sBytesPerPixel) == kMaskFormatCount, array_ size_mismatch); | 247 SK_COMPILE_ASSERT(SK_ARRAY_COUNT(sBytesPerPixel) == kMaskFormatCount, array_ size_mismatch); |
robertphillips
2014/11/26 18:19:35
Seems like we also need:
SK_COMPILE_ASSERT(kA8_Gr
jvanverth1
2014/11/26 19:21:48
Done.
| |
248 | 248 |
249 return sBytesPerPixel[(int) format]; | 249 return sBytesPerPixel[(int) format]; |
250 } | 250 } |
251 | 251 |
252 /** | 252 /** |
253 * Pixel configurations. | 253 * Pixel configurations. |
254 */ | 254 */ |
255 enum GrPixelConfig { | 255 enum GrPixelConfig { |
256 kUnknown_GrPixelConfig, | 256 kUnknown_GrPixelConfig, |
257 kAlpha_8_GrPixelConfig, | 257 kAlpha_8_GrPixelConfig, |
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
713 public: | 713 public: |
714 GrAutoMalloc() : INHERITED() {} | 714 GrAutoMalloc() : INHERITED() {} |
715 explicit GrAutoMalloc(size_t size) : INHERITED(size) {} | 715 explicit GrAutoMalloc(size_t size) : INHERITED(size) {} |
716 virtual ~GrAutoMalloc() {} | 716 virtual ~GrAutoMalloc() {} |
717 private: | 717 private: |
718 typedef GrAutoMallocBaseType INHERITED; | 718 typedef GrAutoMallocBaseType INHERITED; |
719 }; | 719 }; |
720 | 720 |
721 #undef GrAutoMallocBaseType | 721 #undef GrAutoMallocBaseType |
722 #endif | 722 #endif |
OLD | NEW |