Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: src/core/SkColorSpace_Base.h

Issue 2318663003: Delete SkColorSpace::gammaNamed() from public API (Closed) Base URL: https://skia.googlesource.com/skia.git@delunknownnamed
Patch Set: Rebase Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/core/SkColorSpaceXform.cpp ('k') | src/core/SkColorSpace_ICC.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 #include "SkColorSpace.h" 11 #include "SkColorSpace.h"
12 #include "SkData.h" 12 #include "SkData.h"
13 #include "SkTemplates.h" 13 #include "SkTemplates.h"
14 14
15 enum SkGammaNamed : uint8_t {
16 kLinear_SkGammaNamed,
17 kSRGB_SkGammaNamed,
18 k2Dot2Curve_SkGammaNamed,
19 kNonStandard_SkGammaNamed,
20 };
21
15 struct SkGammas : SkRefCnt { 22 struct SkGammas : SkRefCnt {
16 23
17 // There are four possible representations for gamma curves. kNone_Type is used 24 // There are four possible representations for gamma curves. kNone_Type is used
18 // as a placeholder until the struct is initialized. It is not a valid valu e. 25 // as a placeholder until the struct is initialized. It is not a valid valu e.
19 enum class Type : uint8_t { 26 enum class Type : uint8_t {
20 kNone_Type, 27 kNone_Type,
21 kNamed_Type, 28 kNamed_Type,
22 kValue_Type, 29 kValue_Type,
23 kTable_Type, 30 kTable_Type,
24 kParam_Type, 31 kParam_Type,
(...skipping 27 matching lines...) Expand all
52 union Data { 59 union Data {
53 Data() 60 Data()
54 : fTable{ 0, 0 } 61 : fTable{ 0, 0 }
55 {} 62 {}
56 63
57 inline bool operator==(const Data& that) const { 64 inline bool operator==(const Data& that) const {
58 return this->fTable.fOffset == that.fTable.fOffset && 65 return this->fTable.fOffset == that.fTable.fOffset &&
59 this->fTable.fSize == that.fTable.fSize; 66 this->fTable.fSize == that.fTable.fSize;
60 } 67 }
61 68
62 SkColorSpace::GammaNamed fNamed; 69 SkGammaNamed fNamed;
63 float fValue; 70 float fValue;
64 Table fTable; 71 Table fTable;
65 size_t fParamOffset; 72 size_t fParamOffset;
66 73
67 const Params& params(const SkGammas* base) const { 74 const Params& params(const SkGammas* base) const {
68 return *SkTAddOffset<const Params>(base, sizeof(SkGammas) + fParamOf fset); 75 return *SkTAddOffset<const Params>(base, sizeof(SkGammas) + fParamOf fset);
69 } 76 }
70 }; 77 };
71 78
72 bool isNamed(int i) const { 79 bool isNamed(int i) const {
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 void* operator new(size_t size) = delete; 176 void* operator new(size_t size) = delete;
170 void* operator new(size_t, void* p) { return p; } 177 void* operator new(size_t, void* p) { return p; }
171 void operator delete(void* p) { sk_free(p); } 178 void operator delete(void* p) { sk_free(p); }
172 }; 179 };
173 180
174 class SkColorSpace_Base : public SkColorSpace { 181 class SkColorSpace_Base : public SkColorSpace {
175 public: 182 public:
176 183
177 static sk_sp<SkColorSpace> NewRGB(const float gammas[3], const SkMatrix44& t oXYZD50); 184 static sk_sp<SkColorSpace> NewRGB(const float gammas[3], const SkMatrix44& t oXYZD50);
178 185
186 SkGammaNamed gammaNamed() const { return fGammaNamed; }
179 const SkGammas* gammas() const { return fGammas.get(); } 187 const SkGammas* gammas() const { return fGammas.get(); }
180 188
181 const SkColorLookUpTable* colorLUT() const { return fColorLUT.get(); } 189 const SkColorLookUpTable* colorLUT() const { return fColorLUT.get(); }
182 190
183 private: 191 private:
184 192
185 /** 193 /**
186 * FIXME (msarett): 194 * FIXME (msarett):
187 * Hiding this function until we can determine if we need it. Known issues include: 195 * Hiding this function until we can determine if we need it. Known issues include:
188 * Only writes 3x3 matrices 196 * Only writes 3x3 matrices
189 * Only writes float gammas 197 * Only writes float gammas
190 * Rejected by some parsers because the "profile description" is empty 198 * Rejected by some parsers because the "profile description" is empty
191 */ 199 */
192 sk_sp<SkData> writeToICC() const; 200 sk_sp<SkData> writeToICC() const;
193 201
194 static sk_sp<SkColorSpace> NewRGB(GammaNamed gammaNamed, const SkMatrix44& t oXYZD50); 202 static sk_sp<SkColorSpace> NewRGB(SkGammaNamed gammaNamed, const SkMatrix44& toXYZD50);
195 203
196 SkColorSpace_Base(GammaNamed gammaNamed, const SkMatrix44& toXYZ); 204 SkColorSpace_Base(SkGammaNamed gammaNamed, const SkMatrix44& toXYZ);
197 205
198 SkColorSpace_Base(sk_sp<SkColorLookUpTable> colorLUT, GammaNamed gammaNamed, 206 SkColorSpace_Base(sk_sp<SkColorLookUpTable> colorLUT, SkGammaNamed gammaName d,
199 sk_sp<SkGammas> gammas, const SkMatrix44& toXYZ, sk_sp<SkD ata> profileData); 207 sk_sp<SkGammas> gammas, const SkMatrix44& toXYZ, sk_sp<SkD ata> profileData);
200 208
201 sk_sp<SkColorLookUpTable> fColorLUT; 209 sk_sp<SkColorLookUpTable> fColorLUT;
210 const SkGammaNamed fGammaNamed;
202 sk_sp<SkGammas> fGammas; 211 sk_sp<SkGammas> fGammas;
203 sk_sp<SkData> fProfileData; 212 sk_sp<SkData> fProfileData;
204 213
205 friend class SkColorSpace; 214 friend class SkColorSpace;
206 friend class ColorSpaceXformTest; 215 friend class ColorSpaceXformTest;
207 friend class ColorSpaceTest; 216 friend class ColorSpaceTest;
208 typedef SkColorSpace INHERITED; 217 typedef SkColorSpace INHERITED;
209 }; 218 };
210 219
211 static inline SkColorSpace_Base* as_CSB(SkColorSpace* colorSpace) { 220 static inline SkColorSpace_Base* as_CSB(SkColorSpace* colorSpace) {
212 return static_cast<SkColorSpace_Base*>(colorSpace); 221 return static_cast<SkColorSpace_Base*>(colorSpace);
213 } 222 }
214 223
215 static inline const SkColorSpace_Base* as_CSB(const SkColorSpace* colorSpace) { 224 static inline const SkColorSpace_Base* as_CSB(const SkColorSpace* colorSpace) {
216 return static_cast<const SkColorSpace_Base*>(colorSpace); 225 return static_cast<const SkColorSpace_Base*>(colorSpace);
217 } 226 }
218 227
219 static inline SkColorSpace_Base* as_CSB(const sk_sp<SkColorSpace>& colorSpace) { 228 static inline SkColorSpace_Base* as_CSB(const sk_sp<SkColorSpace>& colorSpace) {
220 return static_cast<SkColorSpace_Base*>(colorSpace.get()); 229 return static_cast<SkColorSpace_Base*>(colorSpace.get());
221 } 230 }
222 231
223 #endif 232 #endif
OLDNEW
« no previous file with comments | « src/core/SkColorSpaceXform.cpp ('k') | src/core/SkColorSpace_ICC.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698