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

Side by Side Diff: include/core/SkColorSpace.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 | « no previous file | src/core/SkColorSpace.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_DEFINED 8 #ifndef SkColorSpace_DEFINED
9 #define SkColorSpace_DEFINED 9 #define SkColorSpace_DEFINED
10 10
(...skipping 19 matching lines...) Expand all
30 * Very common wide gamut color space. 30 * Very common wide gamut color space.
31 * Often used by images and monitors. 31 * Often used by images and monitors.
32 */ 32 */
33 kAdobeRGB_Named, 33 kAdobeRGB_Named,
34 }; 34 };
35 35
36 enum GammaNamed : uint8_t { 36 enum GammaNamed : uint8_t {
37 kLinear_GammaNamed, 37 kLinear_GammaNamed,
38 38
39 /** 39 /**
40 * Gamma curve is a close match to the canonical sRGB curve, which has 40 * Transfer function is the canonical sRGB curve, which has a short lin ear segment
41 * a short linear segment followed by a 2.4f exponential. 41 * followed by a 2.4f exponential.
42 */ 42 */
43 kSRGB_GammaNamed, 43 kSRGB_GammaNamed,
44
45 /**
46 * Gamma curve is a close match to the 2.2f exponential curve. This is
47 * used by Adobe RGB profiles and is common on monitors as well.
48 */
49 k2Dot2Curve_GammaNamed,
50
51 /**
52 * Gamma is represented by a look-up table, a parametric curve, or an u ncommon
53 * exponential curve. Or the R, G, and B gammas do not match.
54 */
55 kNonStandard_GammaNamed,
56 }; 44 };
57 45
58 /** 46 /**
59 * Create an SkColorSpace from the src gamma and a transform from src gamut to D50 XYZ. 47 * Create an SkColorSpace from the src gamma and a transform from src gamut to D50 XYZ.
60 */ 48 */
61 static sk_sp<SkColorSpace> NewRGB(GammaNamed gammaNamed, const SkMatrix44& t oXYZD50); 49 static sk_sp<SkColorSpace> NewRGB(GammaNamed gammaNamed, const SkMatrix44& t oXYZD50);
62 50
63 /** 51 /**
64 * Create a common, named SkColorSpace. 52 * Create a common, named SkColorSpace.
65 */ 53 */
66 static sk_sp<SkColorSpace> NewNamed(Named); 54 static sk_sp<SkColorSpace> NewNamed(Named);
67 55
68 /** 56 /**
69 * Create an SkColorSpace from an ICC profile. 57 * Create an SkColorSpace from an ICC profile.
70 */ 58 */
71 static sk_sp<SkColorSpace> NewICC(const void*, size_t); 59 static sk_sp<SkColorSpace> NewICC(const void*, size_t);
72 60
73 /** 61 /**
74 * Create an SkColorSpace with the same gamut as this color space, but with linear gamma. 62 * Create an SkColorSpace with the same gamut as this color space, but with linear gamma.
75 */ 63 */
76 sk_sp<SkColorSpace> makeLinearGamma(); 64 sk_sp<SkColorSpace> makeLinearGamma();
77 65
78 /** 66 /**
79 * DO NOT USE: Will be deleted.
80 */
81 GammaNamed gammaNamed() const { return fGammaNamed; }
82
83 /**
84 * Returns the matrix used to transform src gamut to XYZ D50. 67 * Returns the matrix used to transform src gamut to XYZ D50.
85 */ 68 */
86 const SkMatrix44& xyz() const { return fToXYZD50; } 69 const SkMatrix44& xyz() const { return fToXYZD50; }
87 70
88 /** 71 /**
89 * Returns true if the color space gamma is near enough to be approximated as sRGB. 72 * Returns true if the color space gamma is near enough to be approximated as sRGB.
90 */ 73 */
91 bool gammaCloseToSRGB() const { 74 bool gammaCloseToSRGB() const;
92 return kSRGB_GammaNamed == fGammaNamed || k2Dot2Curve_GammaNamed == fGam maNamed;
93 }
94 75
95 /** 76 /**
96 * Returns true if the color space gamma is linear. 77 * Returns true if the color space gamma is linear.
97 */ 78 */
98 bool gammaIsLinear() const { 79 bool gammaIsLinear() const;
99 return kLinear_GammaNamed == fGammaNamed;
100 }
101 80
102 /** 81 /**
103 * Returns nullptr on failure. Fails when we fallback to serializing ICC d ata and 82 * Returns nullptr on failure. Fails when we fallback to serializing ICC d ata and
104 * the data is too large to serialize. 83 * the data is too large to serialize.
105 */ 84 */
106 sk_sp<SkData> serialize() const; 85 sk_sp<SkData> serialize() const;
107 86
108 /** 87 /**
109 * If |memory| is nullptr, returns the size required to serialize. 88 * If |memory| is nullptr, returns the size required to serialize.
110 * Otherwise, serializes into |memory| and returns the size. 89 * Otherwise, serializes into |memory| and returns the size.
111 */ 90 */
112 size_t writeToMemory(void* memory) const; 91 size_t writeToMemory(void* memory) const;
113 92
114 static sk_sp<SkColorSpace> Deserialize(const void* data, size_t length); 93 static sk_sp<SkColorSpace> Deserialize(const void* data, size_t length);
115 94
116 /** 95 /**
117 * If both are null, we return true. If one is null and the other is not, we return false. 96 * If both are null, we return true. If one is null and the other is not, we return false.
118 * If both are non-null, we do a deeper compare. 97 * If both are non-null, we do a deeper compare.
119 */ 98 */
120 static bool Equals(const SkColorSpace* src, const SkColorSpace* dst); 99 static bool Equals(const SkColorSpace* src, const SkColorSpace* dst);
121 100
122 protected: 101 protected:
123 SkColorSpace(GammaNamed gammaNamed, const SkMatrix44& toXYZD50); 102 SkColorSpace(const SkMatrix44& toXYZD50);
124 103
125 const GammaNamed fGammaNamed;
126 const SkMatrix44 fToXYZD50; 104 const SkMatrix44 fToXYZD50;
127 }; 105 };
128 106
129 #endif 107 #endif
OLDNEW
« no previous file with comments | « no previous file | src/core/SkColorSpace.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698