OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 SkImageInfo_DEFINED | 8 #ifndef SkImageInfo_DEFINED |
9 #define SkImageInfo_DEFINED | 9 #define SkImageInfo_DEFINED |
10 | 10 |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 static const uint8_t gSize[] = { | 105 static const uint8_t gSize[] = { |
106 0, // Unknown | 106 0, // Unknown |
107 1, // Alpha_8 | 107 1, // Alpha_8 |
108 2, // RGB_565 | 108 2, // RGB_565 |
109 2, // ARGB_4444 | 109 2, // ARGB_4444 |
110 4, // RGBA_8888 | 110 4, // RGBA_8888 |
111 4, // BGRA_8888 | 111 4, // BGRA_8888 |
112 1, // kIndex_8 | 112 1, // kIndex_8 |
113 1, // kGray_8 | 113 1, // kGray_8 |
114 }; | 114 }; |
115 SK_COMPILE_ASSERT(SK_ARRAY_COUNT(gSize) == (size_t)(kLastEnum_SkColorType +
1), | 115 static_assert(SK_ARRAY_COUNT(gSize) == (size_t)(kLastEnum_SkColorType + 1), |
116 size_mismatch_with_SkColorType_enum); | 116 "size_mismatch_with_SkColorType_enum"); |
117 | 117 |
118 SkASSERT((size_t)ct < SK_ARRAY_COUNT(gSize)); | 118 SkASSERT((size_t)ct < SK_ARRAY_COUNT(gSize)); |
119 return gSize[ct]; | 119 return gSize[ct]; |
120 } | 120 } |
121 | 121 |
122 static inline size_t SkColorTypeMinRowBytes(SkColorType ct, int width) { | 122 static inline size_t SkColorTypeMinRowBytes(SkColorType ct, int width) { |
123 return width * SkColorTypeBytesPerPixel(ct); | 123 return width * SkColorTypeBytesPerPixel(ct); |
124 } | 124 } |
125 | 125 |
126 static inline bool SkColorTypeIsValid(unsigned value) { | 126 static inline bool SkColorTypeIsValid(unsigned value) { |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 SkImageInfo(int width, int height, SkColorType ct, SkAlphaType at, SkColorPr
ofileType pt) | 325 SkImageInfo(int width, int height, SkColorType ct, SkAlphaType at, SkColorPr
ofileType pt) |
326 : fWidth(width) | 326 : fWidth(width) |
327 , fHeight(height) | 327 , fHeight(height) |
328 , fColorType(ct) | 328 , fColorType(ct) |
329 , fAlphaType(at) | 329 , fAlphaType(at) |
330 , fProfileType(pt) | 330 , fProfileType(pt) |
331 {} | 331 {} |
332 }; | 332 }; |
333 | 333 |
334 #endif | 334 #endif |
OLD | NEW |