| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 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 SkColorSpace_DEFINED | 8 #ifndef SkColorSpace_DEFINED |
| 9 #define SkColorSpace_DEFINED | 9 #define SkColorSpace_DEFINED |
| 10 | 10 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 /** | 41 /** |
| 42 * Create an SkColorSpace from an ICC profile. | 42 * Create an SkColorSpace from an ICC profile. |
| 43 */ | 43 */ |
| 44 static sk_sp<SkColorSpace> NewICC(const void*, size_t); | 44 static sk_sp<SkColorSpace> NewICC(const void*, size_t); |
| 45 | 45 |
| 46 /** | 46 /** |
| 47 * Used interally. | 47 * Used interally. |
| 48 */ | 48 */ |
| 49 SkGammas* gammas() const { return fGammas.get(); } | 49 SkGammas* gammas() const { return fGammas.get(); } |
| 50 | 50 |
| 51 enum GammaNamed { |
| 52 kLinear_GammaNamed, |
| 53 |
| 54 /** |
| 55 * Gamma curve is a close match to the canonical sRGB gamma curve or an
other |
| 56 * similar gamma curve. |
| 57 * |
| 58 * sRGB gamma curves have a short linear segment followed by an exponen
tial (e = 2.4f). |
| 59 * This is very similar to another common exponential curve (e = 2.2f). |
| 60 */ |
| 61 kSRGBCurve_GammaNamed, |
| 62 |
| 63 /** |
| 64 * Gamma is represented by a look-up table, a parametric curve, or an u
ncommon |
| 65 * exponential curve. Or there is an additional pre-processing step be
fore the |
| 66 * applying the gamma. |
| 67 */ |
| 68 kNonStandard_GammaNamed, |
| 69 }; |
| 70 |
| 71 GammaNamed gammaNamed() { return fGammaNamed; } |
| 72 |
| 51 /** | 73 /** |
| 52 * Returns the matrix used to transform src gamut to XYZ D50. | 74 * Returns the matrix used to transform src gamut to XYZ D50. |
| 53 */ | 75 */ |
| 54 SkMatrix44 xyz() const { return fToXYZD50; } | 76 SkMatrix44 xyz() const { return fToXYZD50; } |
| 55 | 77 |
| 56 /** | 78 /** |
| 57 * Returns profile name or kUnknown if it does not match one of our known p
rofiles. | 79 * Returns profile name or kUnknown if it does not match one of our known p
rofiles. |
| 58 */ | 80 */ |
| 59 Named named() const { return fNamed; } | 81 Named named() const { return fNamed; } |
| 60 | 82 |
| 61 private: | 83 private: |
| 62 | 84 |
| 63 static bool LoadGammas(SkGammaCurve* gammas, uint32_t num, const uint8_t* sr
c, size_t len); | 85 static bool LoadGammas(SkGammaCurve* gammas, uint32_t num, const uint8_t* sr
c, size_t len); |
| 64 | 86 |
| 65 static bool LoadColorLUT(SkColorLookUpTable* colorLUT, uint32_t inputChannel
s, | 87 static bool LoadColorLUT(SkColorLookUpTable* colorLUT, uint32_t inputChannel
s, |
| 66 uint32_t outputChannels, const uint8_t* src, size_t
len); | 88 uint32_t outputChannels, const uint8_t* src, size_t
len); |
| 67 | 89 |
| 68 static bool LoadA2B0(SkColorLookUpTable* colorLUT, SkGammaCurve*, SkMatrix44
* toXYZ, | 90 static bool LoadA2B0(SkColorLookUpTable* colorLUT, SkGammaCurve*, SkMatrix44
* toXYZ, |
| 69 const uint8_t* src, size_t len); | 91 const uint8_t* src, size_t len); |
| 70 | 92 |
| 71 SkColorSpace(sk_sp<SkGammas> gammas, const SkMatrix44& toXYZ, Named); | 93 SkColorSpace(sk_sp<SkGammas> gammas, const SkMatrix44& toXYZ, Named); |
| 72 | 94 |
| 95 SkColorSpace(sk_sp<SkGammas> gammas, GammaNamed gammaNamed, const SkMatrix44
& toXYZ, Named); |
| 96 |
| 73 SkColorSpace(SkColorLookUpTable* colorLUT, sk_sp<SkGammas> gammas, const SkM
atrix44& toXYZ); | 97 SkColorSpace(SkColorLookUpTable* colorLUT, sk_sp<SkGammas> gammas, const SkM
atrix44& toXYZ); |
| 74 | 98 |
| 75 SkAutoTDelete<SkColorLookUpTable> fColorLUT; | 99 SkAutoTDelete<SkColorLookUpTable> fColorLUT; |
| 76 sk_sp<SkGammas> fGammas; | 100 sk_sp<SkGammas> fGammas; |
| 101 const GammaNamed fGammaNamed; |
| 77 const SkMatrix44 fToXYZD50; | 102 const SkMatrix44 fToXYZD50; |
| 78 const Named fNamed; | 103 const Named fNamed; |
| 79 }; | 104 }; |
| 80 | 105 |
| 81 #endif | 106 #endif |
| OLD | NEW |