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_Base_DEFINED | 8 #ifndef SkColorSpace_Base_DEFINED |
9 #define SkColorSpace_Base_DEFINED | 9 #define SkColorSpace_Base_DEFINED |
10 | 10 |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 class SkColorSpace_Base : public SkColorSpace { | 170 class SkColorSpace_Base : public SkColorSpace { |
171 public: | 171 public: |
172 SkGammaNamed gammaNamed() const { return fGammaNamed; } | 172 SkGammaNamed gammaNamed() const { return fGammaNamed; } |
173 const SkGammas* gammas() const { return fGammas.get(); } | 173 const SkGammas* gammas() const { return fGammas.get(); } |
174 | 174 |
175 const SkColorLookUpTable* colorLUT() const { return fColorLUT.get(); } | 175 const SkColorLookUpTable* colorLUT() const { return fColorLUT.get(); } |
176 | 176 |
177 const SkMatrix44& toXYZD50() const { return fToXYZD50; } | 177 const SkMatrix44& toXYZD50() const { return fToXYZD50; } |
178 const SkMatrix44& fromXYZD50() const; | 178 const SkMatrix44& fromXYZD50() const; |
179 | 179 |
| 180 void toDstGammaTables(const uint8_t* tables[3], sk_sp<SkData>* storage, int
numTables) const; |
| 181 |
180 /** | 182 /** |
181 * Create an SkColorSpace with the same gamut as this color space, but with
linear gamma. | 183 * Create an SkColorSpace with the same gamut as this color space, but with
linear gamma. |
182 */ | 184 */ |
183 sk_sp<SkColorSpace> makeLinearGamma(); | 185 sk_sp<SkColorSpace> makeLinearGamma(); |
184 | 186 |
185 private: | 187 private: |
186 | 188 |
187 /** | 189 /** |
188 * FIXME (msarett): | 190 * FIXME (msarett): |
189 * Hiding this function until we can determine if we need it. Known issues
include: | 191 * Hiding this function until we can determine if we need it. Known issues
include: |
190 * Only writes 3x3 matrices | 192 * Only writes 3x3 matrices |
191 * Only writes float gammas | 193 * Only writes float gammas |
192 * Rejected by some parsers because the "profile description" is empty | 194 * Rejected by some parsers because the "profile description" is empty |
193 */ | 195 */ |
194 sk_sp<SkData> writeToICC() const; | 196 sk_sp<SkData> writeToICC() const; |
195 | 197 |
196 static sk_sp<SkColorSpace> NewRGB(SkGammaNamed gammaNamed, const SkMatrix44&
toXYZD50); | 198 static sk_sp<SkColorSpace> NewRGB(SkGammaNamed gammaNamed, const SkMatrix44&
toXYZD50); |
197 | 199 |
198 SkColorSpace_Base(SkGammaNamed gammaNamed, const SkMatrix44& toXYZ); | 200 SkColorSpace_Base(SkGammaNamed gammaNamed, const SkMatrix44& toXYZ); |
199 | 201 |
200 SkColorSpace_Base(sk_sp<SkColorLookUpTable> colorLUT, SkGammaNamed gammaName
d, | 202 SkColorSpace_Base(sk_sp<SkColorLookUpTable> colorLUT, SkGammaNamed gammaName
d, |
201 sk_sp<SkGammas> gammas, const SkMatrix44& toXYZ, sk_sp<SkD
ata> profileData); | 203 sk_sp<SkGammas> gammas, const SkMatrix44& toXYZ, sk_sp<SkD
ata> profileData); |
202 | 204 |
203 sk_sp<SkColorLookUpTable> fColorLUT; | 205 sk_sp<SkColorLookUpTable> fColorLUT; |
204 const SkGammaNamed fGammaNamed; | 206 const SkGammaNamed fGammaNamed; |
205 sk_sp<SkGammas> fGammas; | 207 sk_sp<SkGammas> fGammas; |
206 sk_sp<SkData> fProfileData; | 208 sk_sp<SkData> fProfileData; |
207 | 209 |
208 const SkMatrix44 fToXYZD50; | 210 const SkMatrix44 fToXYZD50; |
209 mutable SkMatrix44 fFromXYZD50; | 211 mutable SkMatrix44 fFromXYZD50; |
210 mutable SkOnce fFromXYZOnce; | 212 mutable SkOnce fFromXYZOnce; |
| 213 |
| 214 mutable sk_sp<SkData> fDstStorage; |
| 215 mutable const uint8_t* fToDstGammaTables[3]; |
| 216 mutable SkOnce fToDstGammaOnce; |
211 | 217 |
212 friend class SkColorSpace; | 218 friend class SkColorSpace; |
213 friend class ColorSpaceXformTest; | 219 friend class ColorSpaceXformTest; |
214 friend class ColorSpaceTest; | 220 friend class ColorSpaceTest; |
215 typedef SkColorSpace INHERITED; | 221 typedef SkColorSpace INHERITED; |
216 }; | 222 }; |
217 | 223 |
218 static inline SkColorSpace_Base* as_CSB(SkColorSpace* colorSpace) { | 224 static inline SkColorSpace_Base* as_CSB(SkColorSpace* colorSpace) { |
219 return static_cast<SkColorSpace_Base*>(colorSpace); | 225 return static_cast<SkColorSpace_Base*>(colorSpace); |
220 } | 226 } |
221 | 227 |
222 static inline const SkColorSpace_Base* as_CSB(const SkColorSpace* colorSpace) { | 228 static inline const SkColorSpace_Base* as_CSB(const SkColorSpace* colorSpace) { |
223 return static_cast<const SkColorSpace_Base*>(colorSpace); | 229 return static_cast<const SkColorSpace_Base*>(colorSpace); |
224 } | 230 } |
225 | 231 |
226 static inline SkColorSpace_Base* as_CSB(const sk_sp<SkColorSpace>& colorSpace) { | 232 static inline SkColorSpace_Base* as_CSB(const sk_sp<SkColorSpace>& colorSpace) { |
227 return static_cast<SkColorSpace_Base*>(colorSpace.get()); | 233 return static_cast<SkColorSpace_Base*>(colorSpace.get()); |
228 } | 234 } |
229 | 235 |
230 #endif | 236 #endif |
OLD | NEW |