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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 kAlpha_8_SkColorType, | 73 kAlpha_8_SkColorType, |
74 kRGB_565_SkColorType, | 74 kRGB_565_SkColorType, |
75 kARGB_4444_SkColorType, | 75 kARGB_4444_SkColorType, |
76 kRGBA_8888_SkColorType, | 76 kRGBA_8888_SkColorType, |
77 kBGRA_8888_SkColorType, | 77 kBGRA_8888_SkColorType, |
78 kIndex_8_SkColorType, | 78 kIndex_8_SkColorType, |
79 | 79 |
80 kLastEnum_SkColorType = kIndex_8_SkColorType, | 80 kLastEnum_SkColorType = kIndex_8_SkColorType, |
81 | 81 |
82 #if SK_PMCOLOR_BYTE_ORDER(B,G,R,A) | 82 #if SK_PMCOLOR_BYTE_ORDER(B,G,R,A) |
83 kPMColor_SkColorType = kBGRA_8888_SkColorType | 83 kN32_SkColorType = kBGRA_8888_SkColorType, |
84 #elif SK_PMCOLOR_BYTE_ORDER(R,G,B,A) | 84 #elif SK_PMCOLOR_BYTE_ORDER(R,G,B,A) |
85 kPMColor_SkColorType = kRGBA_8888_SkColorType | 85 kN32_SkColorType = kRGBA_8888_SkColorType, |
86 #else | 86 #else |
87 #error "SK_*32_SHFIT values must correspond to BGRA or RGBA byte order" | 87 #error "SK_*32_SHFIT values must correspond to BGRA or RGBA byte order" |
88 #endif | 88 #endif |
| 89 |
| 90 #ifdef SK_SUPPORT_LEGACY_N32_NAME |
| 91 kPMColor_SkColorType = kN32_SkColorType |
| 92 #endif |
89 }; | 93 }; |
90 | 94 |
91 static int SkColorTypeBytesPerPixel(SkColorType ct) { | 95 static int SkColorTypeBytesPerPixel(SkColorType ct) { |
92 static const uint8_t gSize[] = { | 96 static const uint8_t gSize[] = { |
93 0, // Unknown | 97 0, // Unknown |
94 1, // Alpha_8 | 98 1, // Alpha_8 |
95 2, // RGB_565 | 99 2, // RGB_565 |
96 2, // ARGB_4444 | 100 2, // ARGB_4444 |
97 4, // RGBA_8888 | 101 4, // RGBA_8888 |
98 4, // BGRA_8888 | 102 4, // BGRA_8888 |
(...skipping 30 matching lines...) Expand all Loading... |
129 width, height, ct, at | 133 width, height, ct, at |
130 }; | 134 }; |
131 return info; | 135 return info; |
132 } | 136 } |
133 | 137 |
134 /** | 138 /** |
135 * Sets colortype to the native ARGB32 type. | 139 * Sets colortype to the native ARGB32 type. |
136 */ | 140 */ |
137 static SkImageInfo MakeN32(int width, int height, SkAlphaType at) { | 141 static SkImageInfo MakeN32(int width, int height, SkAlphaType at) { |
138 SkImageInfo info = { | 142 SkImageInfo info = { |
139 width, height, kPMColor_SkColorType, at | 143 width, height, kN32_SkColorType, at |
140 }; | 144 }; |
141 return info; | 145 return info; |
142 } | 146 } |
143 | 147 |
144 /** | 148 /** |
145 * Sets colortype to the native ARGB32 type, and the alphatype to premul. | 149 * Sets colortype to the native ARGB32 type, and the alphatype to premul. |
146 */ | 150 */ |
147 static SkImageInfo MakeN32Premul(int width, int height) { | 151 static SkImageInfo MakeN32Premul(int width, int height) { |
148 SkImageInfo info = { | 152 SkImageInfo info = { |
149 width, height, kPMColor_SkColorType, kPremul_SkAlphaType | 153 width, height, kN32_SkColorType, kPremul_SkAlphaType |
150 }; | 154 }; |
151 return info; | 155 return info; |
152 } | 156 } |
153 | 157 |
154 /** | 158 /** |
155 * Sets colortype to the native ARGB32 type, and the alphatype to premul. | 159 * Sets colortype to the native ARGB32 type, and the alphatype to premul. |
156 */ | 160 */ |
157 static SkImageInfo MakeN32Premul(const SkISize& size) { | 161 static SkImageInfo MakeN32Premul(const SkISize& size) { |
158 return MakeN32Premul(size.width(), size.height()); | 162 return MakeN32Premul(size.width(), size.height()); |
159 } | 163 } |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 | 224 |
221 bool validRowBytes(size_t rowBytes) const { | 225 bool validRowBytes(size_t rowBytes) const { |
222 uint64_t rb = sk_64_mul(fWidth, this->bytesPerPixel()); | 226 uint64_t rb = sk_64_mul(fWidth, this->bytesPerPixel()); |
223 return rowBytes >= rb; | 227 return rowBytes >= rb; |
224 } | 228 } |
225 | 229 |
226 SkDEBUGCODE(void validate() const;) | 230 SkDEBUGCODE(void validate() const;) |
227 }; | 231 }; |
228 | 232 |
229 #endif | 233 #endif |
OLD | NEW |