| 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 kN32_SkColorType = kBGRA_8888_SkColorType, | 83 kPMColor_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 kN32_SkColorType = kRGBA_8888_SkColorType, | 85 kPMColor_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 | |
| 93 }; | 89 }; |
| 94 | 90 |
| 95 static int SkColorTypeBytesPerPixel(SkColorType ct) { | 91 static int SkColorTypeBytesPerPixel(SkColorType ct) { |
| 96 static const uint8_t gSize[] = { | 92 static const uint8_t gSize[] = { |
| 97 0, // Unknown | 93 0, // Unknown |
| 98 1, // Alpha_8 | 94 1, // Alpha_8 |
| 99 2, // RGB_565 | 95 2, // RGB_565 |
| 100 2, // ARGB_4444 | 96 2, // ARGB_4444 |
| 101 4, // RGBA_8888 | 97 4, // RGBA_8888 |
| 102 4, // BGRA_8888 | 98 4, // BGRA_8888 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 133 width, height, ct, at | 129 width, height, ct, at |
| 134 }; | 130 }; |
| 135 return info; | 131 return info; |
| 136 } | 132 } |
| 137 | 133 |
| 138 /** | 134 /** |
| 139 * Sets colortype to the native ARGB32 type. | 135 * Sets colortype to the native ARGB32 type. |
| 140 */ | 136 */ |
| 141 static SkImageInfo MakeN32(int width, int height, SkAlphaType at) { | 137 static SkImageInfo MakeN32(int width, int height, SkAlphaType at) { |
| 142 SkImageInfo info = { | 138 SkImageInfo info = { |
| 143 width, height, kN32_SkColorType, at | 139 width, height, kPMColor_SkColorType, at |
| 144 }; | 140 }; |
| 145 return info; | 141 return info; |
| 146 } | 142 } |
| 147 | 143 |
| 148 /** | 144 /** |
| 149 * Sets colortype to the native ARGB32 type, and the alphatype to premul. | 145 * Sets colortype to the native ARGB32 type, and the alphatype to premul. |
| 150 */ | 146 */ |
| 151 static SkImageInfo MakeN32Premul(int width, int height) { | 147 static SkImageInfo MakeN32Premul(int width, int height) { |
| 152 SkImageInfo info = { | 148 SkImageInfo info = { |
| 153 width, height, kN32_SkColorType, kPremul_SkAlphaType | 149 width, height, kPMColor_SkColorType, kPremul_SkAlphaType |
| 154 }; | 150 }; |
| 155 return info; | 151 return info; |
| 156 } | 152 } |
| 157 | 153 |
| 158 /** | 154 /** |
| 159 * Sets colortype to the native ARGB32 type, and the alphatype to premul. | 155 * Sets colortype to the native ARGB32 type, and the alphatype to premul. |
| 160 */ | 156 */ |
| 161 static SkImageInfo MakeN32Premul(const SkISize& size) { | 157 static SkImageInfo MakeN32Premul(const SkISize& size) { |
| 162 return MakeN32Premul(size.width(), size.height()); | 158 return MakeN32Premul(size.width(), size.height()); |
| 163 } | 159 } |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 | 220 |
| 225 bool validRowBytes(size_t rowBytes) const { | 221 bool validRowBytes(size_t rowBytes) const { |
| 226 uint64_t rb = sk_64_mul(fWidth, this->bytesPerPixel()); | 222 uint64_t rb = sk_64_mul(fWidth, this->bytesPerPixel()); |
| 227 return rowBytes >= rb; | 223 return rowBytes >= rb; |
| 228 } | 224 } |
| 229 | 225 |
| 230 SkDEBUGCODE(void validate() const;) | 226 SkDEBUGCODE(void validate() const;) |
| 231 }; | 227 }; |
| 232 | 228 |
| 233 #endif | 229 #endif |
| OLD | NEW |