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 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 , fWidth(width) | 372 , fWidth(width) |
373 , fHeight(height) | 373 , fHeight(height) |
374 , fColorType(ct) | 374 , fColorType(ct) |
375 , fAlphaType(at) | 375 , fAlphaType(at) |
376 , fProfileType(pt) | 376 , fProfileType(pt) |
377 {} | 377 {} |
378 }; | 378 }; |
379 | 379 |
380 /////////////////////////////////////////////////////////////////////////////// | 380 /////////////////////////////////////////////////////////////////////////////// |
381 | 381 |
382 static inline bool SkColorAndColorSpaceAreGammaCorrect(SkColorType ct, SkColorSp
ace* cs) { | 382 static inline bool SkColorAndProfileAreGammaCorrect(SkColorType ct, SkColorProfi
leType pt) { |
383 // Anything with a color-space attached is gamma-correct, as is F16. | 383 return kSRGB_SkColorProfileType == pt || kRGBA_F16_SkColorType == ct; |
384 // To get legacy behavior, you need to ask for non-F16, with a nullptr color
space. | |
385 return (cs != nullptr) || kRGBA_F16_SkColorType == ct; | |
386 } | 384 } |
387 | 385 |
388 static inline bool SkImageInfoIsGammaCorrect(const SkImageInfo& info) { | 386 static inline bool SkImageInfoIsGammaCorrect(const SkImageInfo& info) { |
389 return SkColorAndColorSpaceAreGammaCorrect(info.colorType(), info.colorSpace
()); | 387 return SkColorAndProfileAreGammaCorrect(info.colorType(), info.profileType()
); |
390 } | 388 } |
391 | 389 |
392 #endif | 390 #endif |
OLD | NEW |