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 SkColorSpacePriv_DEFINED | 8 #ifndef SkColorSpace_Base_DEFINED |
9 #define SkColorSpacePriv_DEFINED | 9 #define SkColorSpace_Base_DEFINED |
| 10 |
| 11 #include "SkColorSpace.h" |
10 | 12 |
11 struct SkGammaCurve { | 13 struct SkGammaCurve { |
12 bool isValue() const { | 14 bool isValue() const { |
13 bool result = (0.0f != fValue); | 15 bool result = (0.0f != fValue); |
14 SkASSERT(!result || (0 == fTableSize)); | 16 SkASSERT(!result || (0 == fTableSize)); |
15 return result; | 17 return result; |
16 } | 18 } |
17 | 19 |
18 bool isTable() const { | 20 bool isTable() const { |
19 bool result = (0 != fTableSize); | 21 bool result = (0 != fTableSize); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 uint8_t fInputChannels; | 81 uint8_t fInputChannels; |
80 uint8_t fOutputChannels; | 82 uint8_t fOutputChannels; |
81 uint8_t fGridPoints[kMaxChannels]; | 83 uint8_t fGridPoints[kMaxChannels]; |
82 std::unique_ptr<float[]> fTable; | 84 std::unique_ptr<float[]> fTable; |
83 | 85 |
84 SkColorLookUpTable() { | 86 SkColorLookUpTable() { |
85 memset(this, 0, sizeof(struct SkColorLookUpTable)); | 87 memset(this, 0, sizeof(struct SkColorLookUpTable)); |
86 } | 88 } |
87 }; | 89 }; |
88 | 90 |
| 91 class SkColorSpace_Base : public SkColorSpace { |
| 92 public: |
| 93 |
| 94 SkGammas* gammas() const { return fGammas.get(); } |
| 95 |
| 96 private: |
| 97 |
| 98 SkColorSpace_Base(sk_sp<SkGammas> gammas, const SkMatrix44& toXYZ, Named); |
| 99 |
| 100 SkColorSpace_Base(sk_sp<SkGammas> gammas, GammaNamed gammaNamed, const SkMat
rix44& toXYZ, |
| 101 Named); |
| 102 |
| 103 SkColorSpace_Base(SkColorLookUpTable* colorLUT, sk_sp<SkGammas> gammas, |
| 104 const SkMatrix44& toXYZ); |
| 105 |
| 106 SkAutoTDelete<SkColorLookUpTable> fColorLUT; |
| 107 sk_sp<SkGammas> fGammas; |
| 108 |
| 109 friend class SkColorSpace; |
| 110 typedef SkColorSpace INHERITED; |
| 111 }; |
| 112 |
| 113 static inline SkColorSpace_Base* as_CSB(SkColorSpace* colorSpace) { |
| 114 return static_cast<SkColorSpace_Base*>(colorSpace); |
| 115 } |
| 116 |
89 #endif | 117 #endif |
OLD | NEW |