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

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

Issue 2005263002: SkColorSpace tweaks (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 7 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/SkColorSpace.cpp ('k') | tests/ColorSpaceTest.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 "SkTemplates.h"
12 13
13 struct SkGammaCurve { 14 struct SkGammaCurve {
14 bool isValue() const { 15 bool isValue() const {
15 bool result = (0.0f != fValue); 16 bool result = (0.0f != fValue);
16 SkASSERT(!result || (0 == fTableSize)); 17 SkASSERT(!result || (0 == fTableSize));
17 SkASSERT(!result || (0.0f == fG)); 18 SkASSERT(!result || (0.0f == fG));
18 return result; 19 return result;
19 } 20 }
20 21
21 bool isTable() const { 22 bool isTable() const {
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 std::unique_ptr<float[]> fTable; 107 std::unique_ptr<float[]> fTable;
107 108
108 SkColorLookUpTable() { 109 SkColorLookUpTable() {
109 memset(this, 0, sizeof(struct SkColorLookUpTable)); 110 memset(this, 0, sizeof(struct SkColorLookUpTable));
110 } 111 }
111 }; 112 };
112 113
113 class SkColorSpace_Base : public SkColorSpace { 114 class SkColorSpace_Base : public SkColorSpace {
114 public: 115 public:
115 116
116 SkGammas* gammas() const { return fGammas.get(); } 117 const sk_sp<SkGammas>& gammas() const { return fGammas; }
117 118
118 private: 119 private:
119 120
120 SkColorSpace_Base(sk_sp<SkGammas> gammas, const SkMatrix44& toXYZ, Named); 121 SkColorSpace_Base(sk_sp<SkGammas> gammas, const SkMatrix44& toXYZ, Named);
121 122
122 SkColorSpace_Base(sk_sp<SkGammas> gammas, GammaNamed gammaNamed, const SkMat rix44& toXYZ, 123 SkColorSpace_Base(sk_sp<SkGammas> gammas, GammaNamed gammaNamed, const SkMat rix44& toXYZ,
123 Named); 124 Named);
124 125
125 SkColorSpace_Base(SkColorLookUpTable* colorLUT, sk_sp<SkGammas> gammas, 126 SkColorSpace_Base(SkColorLookUpTable* colorLUT, sk_sp<SkGammas> gammas,
126 const SkMatrix44& toXYZ); 127 const SkMatrix44& toXYZ);
127 128
128 SkAutoTDelete<SkColorLookUpTable> fColorLUT; 129 SkAutoTDelete<SkColorLookUpTable> fColorLUT;
129 sk_sp<SkGammas> fGammas; 130 sk_sp<SkGammas> fGammas;
130 131
131 friend class SkColorSpace; 132 friend class SkColorSpace;
132 typedef SkColorSpace INHERITED; 133 typedef SkColorSpace INHERITED;
133 }; 134 };
134 135
135 static inline SkColorSpace_Base* as_CSB(SkColorSpace* colorSpace) { 136 static inline SkColorSpace_Base* as_CSB(SkColorSpace* colorSpace) {
136 return static_cast<SkColorSpace_Base*>(colorSpace); 137 return static_cast<SkColorSpace_Base*>(colorSpace);
137 } 138 }
138 139
139 static inline SkColorSpace_Base* as_CSB(const sk_sp<SkColorSpace>& colorSpace) { 140 static inline SkColorSpace_Base* as_CSB(const sk_sp<SkColorSpace>& colorSpace) {
140 return static_cast<SkColorSpace_Base*>(colorSpace.get()); 141 return static_cast<SkColorSpace_Base*>(colorSpace.get());
141 } 142 }
142 143
143 #endif 144 #endif
OLDNEW
« no previous file with comments | « src/core/SkColorSpace.cpp ('k') | tests/ColorSpaceTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698