| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2010 Google Inc. | 2 * Copyright 2010 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef GrTypes_DEFINED | 8 #ifndef GrTypes_DEFINED |
| 9 #define GrTypes_DEFINED | 9 #define GrTypes_DEFINED |
| 10 | 10 |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 kARGB_GrMaskFormat, //!< 4-bytes per pixel, color format | 173 kARGB_GrMaskFormat, //!< 4-bytes per pixel, color format |
| 174 | 174 |
| 175 kLast_GrMaskFormat = kARGB_GrMaskFormat | 175 kLast_GrMaskFormat = kARGB_GrMaskFormat |
| 176 }; | 176 }; |
| 177 static const int kMaskFormatCount = kLast_GrMaskFormat + 1; | 177 static const int kMaskFormatCount = kLast_GrMaskFormat + 1; |
| 178 | 178 |
| 179 /** | 179 /** |
| 180 * Return the number of bytes-per-pixel for the specified mask format. | 180 * Return the number of bytes-per-pixel for the specified mask format. |
| 181 */ | 181 */ |
| 182 static inline int GrMaskFormatBytesPerPixel(GrMaskFormat format) { | 182 static inline int GrMaskFormatBytesPerPixel(GrMaskFormat format) { |
| 183 SkASSERT((unsigned)format < kMaskFormatCount); | 183 SkASSERT(format < kMaskFormatCount); |
| 184 // kA8 (0) -> 1 | 184 // kA8 (0) -> 1 |
| 185 // kA565 (1) -> 2 | 185 // kA565 (1) -> 2 |
| 186 // kARGB (2) -> 4 | 186 // kARGB (2) -> 4 |
| 187 static const int sBytesPerPixel[] = { 1, 2, 4 }; | 187 static const int sBytesPerPixel[] = { 1, 2, 4 }; |
| 188 static_assert(SK_ARRAY_COUNT(sBytesPerPixel) == kMaskFormatCount, "array_siz
e_mismatch"); | 188 static_assert(SK_ARRAY_COUNT(sBytesPerPixel) == kMaskFormatCount, "array_siz
e_mismatch"); |
| 189 static_assert(kA8_GrMaskFormat == 0, "enum_order_dependency"); | 189 static_assert(kA8_GrMaskFormat == 0, "enum_order_dependency"); |
| 190 static_assert(kA565_GrMaskFormat == 1, "enum_order_dependency"); | 190 static_assert(kA565_GrMaskFormat == 1, "enum_order_dependency"); |
| 191 static_assert(kARGB_GrMaskFormat == 2, "enum_order_dependency"); | 191 static_assert(kARGB_GrMaskFormat == 2, "enum_order_dependency"); |
| 192 | 192 |
| 193 return sBytesPerPixel[(int) format]; | 193 return sBytesPerPixel[(int) format]; |
| (...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 638 return 4 * width * height; | 638 return 4 * width * height; |
| 639 } | 639 } |
| 640 } | 640 } |
| 641 | 641 |
| 642 /** | 642 /** |
| 643 * This value translates to reseting all the context state for any backend. | 643 * This value translates to reseting all the context state for any backend. |
| 644 */ | 644 */ |
| 645 static const uint32_t kAll_GrBackendState = 0xffffffff; | 645 static const uint32_t kAll_GrBackendState = 0xffffffff; |
| 646 | 646 |
| 647 #endif | 647 #endif |
| OLD | NEW |