| 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 |
| 11 #include "SkMatrix44.h" | 11 #include "SkMatrix44.h" |
| 12 #include "SkRefCnt.h" | 12 #include "SkRefCnt.h" |
| 13 | 13 |
| 14 class SkData; | 14 class SkData; |
| 15 | 15 |
| 16 class SK_API SkColorSpace : public SkRefCnt { | 16 class SK_API SkColorSpace : public SkRefCnt { |
| 17 public: | 17 public: |
| 18 | 18 |
| 19 /** | 19 /** |
| 20 * Common, named profiles that we can recognize. | 20 * Common, named profiles that we can recognize. |
| 21 */ | 21 */ |
| 22 enum Named : uint8_t { | 22 enum Named { |
| 23 /** | 23 kUnknown_Named, |
| 24 * By far the most common color space. | |
| 25 * This is the default space for images, unmarked content, and monitors
. | |
| 26 */ | |
| 27 kSRGB_Named, | 24 kSRGB_Named, |
| 28 | |
| 29 /** | |
| 30 * Very common wide gamut color space. | |
| 31 * Often used by images and monitors. | |
| 32 */ | |
| 33 kAdobeRGB_Named, | 25 kAdobeRGB_Named, |
| 34 }; | 26 }; |
| 35 | 27 |
| 36 enum GammaNamed : uint8_t { | 28 enum GammaNamed { |
| 37 kLinear_GammaNamed, | 29 kLinear_GammaNamed, |
| 38 | 30 |
| 39 /** | 31 /** |
| 40 * Gamma curve is a close match to the canonical sRGB curve, which has | 32 * Gamma curve is a close match to the canonical sRGB curve, which has |
| 41 * a short linear segment followed by a 2.4f exponential. | 33 * a short linear segment followed by a 2.4f exponential. |
| 42 */ | 34 */ |
| 43 kSRGB_GammaNamed, | 35 kSRGB_GammaNamed, |
| 44 | 36 |
| 45 /** | 37 /** |
| 46 * Gamma curve is a close match to the 2.2f exponential curve. This is | 38 * Gamma curve is a close match to the 2.2f exponential curve. This is |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 | 109 |
| 118 static sk_sp<SkColorSpace> Deserialize(const void* data, size_t length); | 110 static sk_sp<SkColorSpace> Deserialize(const void* data, size_t length); |
| 119 | 111 |
| 120 /** | 112 /** |
| 121 * If both are null, we return true. If one is null and the other is not,
we return false. | 113 * If both are null, we return true. If one is null and the other is not,
we return false. |
| 122 * If both are non-null, we do a deeper compare. | 114 * If both are non-null, we do a deeper compare. |
| 123 */ | 115 */ |
| 124 static bool Equals(const SkColorSpace* src, const SkColorSpace* dst); | 116 static bool Equals(const SkColorSpace* src, const SkColorSpace* dst); |
| 125 | 117 |
| 126 protected: | 118 protected: |
| 127 SkColorSpace(GammaNamed gammaNamed, const SkMatrix44& toXYZD50); | 119 SkColorSpace(GammaNamed gammaNamed, const SkMatrix44& toXYZD50, Named named)
; |
| 128 | 120 |
| 129 const GammaNamed fGammaNamed; | 121 const GammaNamed fGammaNamed; |
| 130 const SkMatrix44 fToXYZD50; | 122 const SkMatrix44 fToXYZD50; |
| 123 const Named fNamed; |
| 131 }; | 124 }; |
| 132 | 125 |
| 133 #endif | 126 #endif |
| OLD | NEW |