| 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 |
| 11 #include "SkColorSpace.h" | 11 #include "SkColorSpace.h" |
| 12 #include "SkMath.h" | 12 #include "SkMath.h" |
| 13 #include "SkRect.h" | 13 #include "SkRect.h" |
| 14 #include "SkSize.h" | 14 #include "SkSize.h" |
| 15 | 15 |
| 16 #define SK_SUPPORT_LEGACY_COLORPROFILETYPE | |
| 17 | |
| 18 class SkReadBuffer; | 16 class SkReadBuffer; |
| 19 class SkWriteBuffer; | 17 class SkWriteBuffer; |
| 20 | 18 |
| 21 /** | 19 /** |
| 22 * Describes how to interpret the alpha component of a pixel. | 20 * Describes how to interpret the alpha component of a pixel. |
| 23 */ | 21 */ |
| 24 enum SkAlphaType { | 22 enum SkAlphaType { |
| 25 kUnknown_SkAlphaType, | 23 kUnknown_SkAlphaType, |
| 26 | 24 |
| 27 /** | 25 /** |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 } | 211 } |
| 214 | 212 |
| 215 /** | 213 /** |
| 216 * Create an ImageInfo marked as SRGB with N32 swizzle. | 214 * Create an ImageInfo marked as SRGB with N32 swizzle. |
| 217 */ | 215 */ |
| 218 static SkImageInfo MakeS32(int width, int height, SkAlphaType at); | 216 static SkImageInfo MakeS32(int width, int height, SkAlphaType at); |
| 219 | 217 |
| 220 /** | 218 /** |
| 221 * Sets colortype to the native ARGB32 type, and the alphatype to premul. | 219 * Sets colortype to the native ARGB32 type, and the alphatype to premul. |
| 222 */ | 220 */ |
| 223 static SkImageInfo MakeN32Premul(int width, int height) { | 221 static SkImageInfo MakeN32Premul(int width, int height, sk_sp<SkColorSpace>
cs = nullptr) { |
| 224 return Make(width, height, kN32_SkColorType, kPremul_SkAlphaType, nullpt
r); | 222 return Make(width, height, kN32_SkColorType, kPremul_SkAlphaType, cs); |
| 225 } | 223 } |
| 226 | 224 |
| 227 static SkImageInfo MakeN32Premul(const SkISize& size) { | 225 static SkImageInfo MakeN32Premul(const SkISize& size) { |
| 228 return MakeN32Premul(size.width(), size.height()); | 226 return MakeN32Premul(size.width(), size.height()); |
| 229 } | 227 } |
| 230 | 228 |
| 231 static SkImageInfo MakeA8(int width, int height) { | 229 static SkImageInfo MakeA8(int width, int height) { |
| 232 return Make(width, height, kAlpha_8_SkColorType, kPremul_SkAlphaType, nu
llptr); | 230 return Make(width, height, kAlpha_8_SkColorType, kPremul_SkAlphaType, nu
llptr); |
| 233 } | 231 } |
| 234 | 232 |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 // Anything with a color-space attached is gamma-correct, as is F16. | 396 // Anything with a color-space attached is gamma-correct, as is F16. |
| 399 // To get legacy behavior, you need to ask for non-F16, with a nullptr color
space. | 397 // To get legacy behavior, you need to ask for non-F16, with a nullptr color
space. |
| 400 return (cs != nullptr) || kRGBA_F16_SkColorType == ct; | 398 return (cs != nullptr) || kRGBA_F16_SkColorType == ct; |
| 401 } | 399 } |
| 402 | 400 |
| 403 static inline bool SkImageInfoIsGammaCorrect(const SkImageInfo& info) { | 401 static inline bool SkImageInfoIsGammaCorrect(const SkImageInfo& info) { |
| 404 return SkColorAndColorSpaceAreGammaCorrect(info.colorType(), info.colorSpace
()); | 402 return SkColorAndColorSpaceAreGammaCorrect(info.colorType(), info.colorSpace
()); |
| 405 } | 403 } |
| 406 | 404 |
| 407 #endif | 405 #endif |
| OLD | NEW |