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

Side by Side Diff: src/gpu/effects/GrBezierEffect.h

Issue 2041113004: sk_sp for gpu. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Reserve correctly. Created 4 years, 6 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/gpu/batches/GrTessellatingPathRenderer.cpp ('k') | src/gpu/effects/GrBezierEffect.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 2013 Google Inc. 2 * Copyright 2013 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 GrBezierEffect_DEFINED 8 #ifndef GrBezierEffect_DEFINED
9 #define GrBezierEffect_DEFINED 9 #define GrBezierEffect_DEFINED
10 10
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 * chopping to tighten the clipping. Another side effect of the overestimating i s 51 * chopping to tighten the clipping. Another side effect of the overestimating i s
52 * that the curves become much thinner and "ropey". If all that was ever rendere d 52 * that the curves become much thinner and "ropey". If all that was ever rendere d
53 * were "not too thin" curves and ellipses then 2nd order may have an advantage since 53 * were "not too thin" curves and ellipses then 2nd order may have an advantage since
54 * only one geometry would need to be rendered. However no benches were run comp aring 54 * only one geometry would need to be rendered. However no benches were run comp aring
55 * chopped first order and non chopped 2nd order. 55 * chopped first order and non chopped 2nd order.
56 */ 56 */
57 class GrGLConicEffect; 57 class GrGLConicEffect;
58 58
59 class GrConicEffect : public GrGeometryProcessor { 59 class GrConicEffect : public GrGeometryProcessor {
60 public: 60 public:
61 static GrGeometryProcessor* Create(GrColor color, 61 static sk_sp<GrGeometryProcessor> Make(GrColor color,
62 const SkMatrix& viewMatrix, 62 const SkMatrix& viewMatrix,
63 const GrPrimitiveEdgeType edgeType, 63 const GrPrimitiveEdgeType edgeType,
64 const GrCaps& caps, 64 const GrCaps& caps,
65 const SkMatrix& localMatrix, 65 const SkMatrix& localMatrix,
66 bool usesLocalCoords, 66 bool usesLocalCoords,
67 uint8_t coverage = 0xff) { 67 uint8_t coverage = 0xff) {
68 switch (edgeType) { 68 switch (edgeType) {
69 case kFillAA_GrProcessorEdgeType: 69 case kFillAA_GrProcessorEdgeType:
70 if (!caps.shaderCaps()->shaderDerivativeSupport()) { 70 if (!caps.shaderCaps()->shaderDerivativeSupport()) {
71 return nullptr; 71 return nullptr;
72 } 72 }
73 return new GrConicEffect(color, viewMatrix, coverage, kFillAA_Gr ProcessorEdgeType, 73 return sk_sp<GrGeometryProcessor>(
74 localMatrix, usesLocalCoords); 74 new GrConicEffect(color, viewMatrix, coverage, kFillAA_GrPro cessorEdgeType,
75 localMatrix, usesLocalCoords));
75 case kHairlineAA_GrProcessorEdgeType: 76 case kHairlineAA_GrProcessorEdgeType:
76 if (!caps.shaderCaps()->shaderDerivativeSupport()) { 77 if (!caps.shaderCaps()->shaderDerivativeSupport()) {
77 return nullptr; 78 return nullptr;
78 } 79 }
79 return new GrConicEffect(color, viewMatrix, coverage, 80 return sk_sp<GrGeometryProcessor>(
80 kHairlineAA_GrProcessorEdgeType, localM atrix, 81 new GrConicEffect(color, viewMatrix, coverage,
81 usesLocalCoords); 82 kHairlineAA_GrProcessorEdgeType, localMatr ix,
83 usesLocalCoords));
82 case kFillBW_GrProcessorEdgeType: 84 case kFillBW_GrProcessorEdgeType:
83 return new GrConicEffect(color, viewMatrix, coverage, kFillBW_Gr ProcessorEdgeType, 85 return sk_sp<GrGeometryProcessor>(
84 localMatrix, usesLocalCoords); 86 new GrConicEffect(color, viewMatrix, coverage, kFillBW_GrPro cessorEdgeType,
87 localMatrix, usesLocalCoords));
85 default: 88 default:
86 return nullptr; 89 return nullptr;
87 } 90 }
88 } 91 }
89 92
90 virtual ~GrConicEffect(); 93 virtual ~GrConicEffect();
91 94
92 const char* name() const override { return "Conic"; } 95 const char* name() const override { return "Conic"; }
93 96
94 inline const Attribute* inPosition() const { return fInPosition; } 97 inline const Attribute* inPosition() const { return fInPosition; }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 * Quadratic specified by 0=u^2-v canonical coords. u and v are the first 134 * Quadratic specified by 0=u^2-v canonical coords. u and v are the first
132 * two components of the vertex attribute. At the three control points that defi ne 135 * two components of the vertex attribute. At the three control points that defi ne
133 * the Quadratic, u, v have the values {0,0}, {1/2, 0}, and {1, 1} respectively. 136 * the Quadratic, u, v have the values {0,0}, {1/2, 0}, and {1, 1} respectively.
134 * Coverage for AA is min(0, 1-distance). 3rd & 4th cimponent unused. 137 * Coverage for AA is min(0, 1-distance). 3rd & 4th cimponent unused.
135 * Requires shader derivative instruction support. 138 * Requires shader derivative instruction support.
136 */ 139 */
137 class GrGLQuadEffect; 140 class GrGLQuadEffect;
138 141
139 class GrQuadEffect : public GrGeometryProcessor { 142 class GrQuadEffect : public GrGeometryProcessor {
140 public: 143 public:
141 static GrGeometryProcessor* Create(GrColor color, 144 static sk_sp<GrGeometryProcessor> Make(GrColor color,
142 const SkMatrix& viewMatrix, 145 const SkMatrix& viewMatrix,
143 const GrPrimitiveEdgeType edgeType, 146 const GrPrimitiveEdgeType edgeType,
144 const GrCaps& caps, 147 const GrCaps& caps,
145 const SkMatrix& localMatrix, 148 const SkMatrix& localMatrix,
146 bool usesLocalCoords, 149 bool usesLocalCoords,
147 uint8_t coverage = 0xff) { 150 uint8_t coverage = 0xff) {
148 switch (edgeType) { 151 switch (edgeType) {
149 case kFillAA_GrProcessorEdgeType: 152 case kFillAA_GrProcessorEdgeType:
150 if (!caps.shaderCaps()->shaderDerivativeSupport()) { 153 if (!caps.shaderCaps()->shaderDerivativeSupport()) {
151 return nullptr; 154 return nullptr;
152 } 155 }
153 return new GrQuadEffect(color, viewMatrix, coverage, kFillAA_GrP rocessorEdgeType, 156 return sk_sp<GrGeometryProcessor>(
154 localMatrix, usesLocalCoords); 157 new GrQuadEffect(color, viewMatrix, coverage, kFillAA_GrProc essorEdgeType,
158 localMatrix, usesLocalCoords));
155 case kHairlineAA_GrProcessorEdgeType: 159 case kHairlineAA_GrProcessorEdgeType:
156 if (!caps.shaderCaps()->shaderDerivativeSupport()) { 160 if (!caps.shaderCaps()->shaderDerivativeSupport()) {
157 return nullptr; 161 return nullptr;
158 } 162 }
159 return new GrQuadEffect(color, viewMatrix, coverage, 163 return sk_sp<GrGeometryProcessor>(
160 kHairlineAA_GrProcessorEdgeType, localMa trix, 164 new GrQuadEffect(color, viewMatrix, coverage,
161 usesLocalCoords); 165 kHairlineAA_GrProcessorEdgeType, localMatri x,
166 usesLocalCoords));
162 case kFillBW_GrProcessorEdgeType: 167 case kFillBW_GrProcessorEdgeType:
163 return new GrQuadEffect(color, viewMatrix, coverage, kFillBW_GrP rocessorEdgeType, 168 return sk_sp<GrGeometryProcessor>(
164 localMatrix, usesLocalCoords); 169 new GrQuadEffect(color, viewMatrix, coverage, kFillBW_GrProc essorEdgeType,
170 localMatrix, usesLocalCoords));
165 default: 171 default:
166 return nullptr; 172 return nullptr;
167 } 173 }
168 } 174 }
169 175
170 virtual ~GrQuadEffect(); 176 virtual ~GrQuadEffect();
171 177
172 const char* name() const override { return "Quad"; } 178 const char* name() const override { return "Quad"; }
173 179
174 inline const Attribute* inPosition() const { return fInPosition; } 180 inline const Attribute* inPosition() const { return fInPosition; }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 * Cubics are specified by implicit equation K^3 - LM. 219 * Cubics are specified by implicit equation K^3 - LM.
214 * K, L, and M, are the first three values of the vertex attribute, 220 * K, L, and M, are the first three values of the vertex attribute,
215 * the fourth value is not used. Distance is calculated using a 221 * the fourth value is not used. Distance is calculated using a
216 * first order approximation from the taylor series. 222 * first order approximation from the taylor series.
217 * Coverage for AA is max(0, 1-distance). 223 * Coverage for AA is max(0, 1-distance).
218 */ 224 */
219 class GrGLCubicEffect; 225 class GrGLCubicEffect;
220 226
221 class GrCubicEffect : public GrGeometryProcessor { 227 class GrCubicEffect : public GrGeometryProcessor {
222 public: 228 public:
223 static GrGeometryProcessor* Create(GrColor color, 229 static sk_sp<GrGeometryProcessor> Make(GrColor color,
224 const SkMatrix& viewMatrix, 230 const SkMatrix& viewMatrix,
225 const GrPrimitiveEdgeType edgeType, 231 const GrPrimitiveEdgeType edgeType,
226 const GrCaps& caps) { 232 const GrCaps& caps) {
227 switch (edgeType) { 233 switch (edgeType) {
228 case kFillAA_GrProcessorEdgeType: 234 case kFillAA_GrProcessorEdgeType:
229 if (!caps.shaderCaps()->shaderDerivativeSupport()) { 235 if (!caps.shaderCaps()->shaderDerivativeSupport()) {
230 return nullptr; 236 return nullptr;
231 } 237 }
232 return new GrCubicEffect(color, viewMatrix, kFillAA_GrProcessorE dgeType); 238 return sk_sp<GrGeometryProcessor>(
239 new GrCubicEffect(color, viewMatrix, kFillAA_GrProcessorEdge Type));
233 case kHairlineAA_GrProcessorEdgeType: 240 case kHairlineAA_GrProcessorEdgeType:
234 if (!caps.shaderCaps()->shaderDerivativeSupport()) { 241 if (!caps.shaderCaps()->shaderDerivativeSupport()) {
235 return nullptr; 242 return nullptr;
236 } 243 }
237 return new GrCubicEffect(color, viewMatrix, kHairlineAA_GrProces sorEdgeType); 244 return sk_sp<GrGeometryProcessor>(
245 new GrCubicEffect(color, viewMatrix, kHairlineAA_GrProcessor EdgeType));
238 case kFillBW_GrProcessorEdgeType: 246 case kFillBW_GrProcessorEdgeType:
239 return new GrCubicEffect(color, viewMatrix, kFillBW_GrProcessorE dgeType); 247 return sk_sp<GrGeometryProcessor>(
248 new GrCubicEffect(color, viewMatrix, kFillBW_GrProcessorEdge Type));
240 default: 249 default:
241 return nullptr; 250 return nullptr;
242 } 251 }
243 } 252 }
244 253
245 virtual ~GrCubicEffect(); 254 virtual ~GrCubicEffect();
246 255
247 const char* name() const override { return "Cubic"; } 256 const char* name() const override { return "Cubic"; }
248 257
249 inline const Attribute* inPosition() const { return fInPosition; } 258 inline const Attribute* inPosition() const { return fInPosition; }
(...skipping 17 matching lines...) Expand all
267 GrPrimitiveEdgeType fEdgeType; 276 GrPrimitiveEdgeType fEdgeType;
268 const Attribute* fInPosition; 277 const Attribute* fInPosition;
269 const Attribute* fInCubicCoeffs; 278 const Attribute* fInCubicCoeffs;
270 279
271 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; 280 GR_DECLARE_GEOMETRY_PROCESSOR_TEST;
272 281
273 typedef GrGeometryProcessor INHERITED; 282 typedef GrGeometryProcessor INHERITED;
274 }; 283 };
275 284
276 #endif 285 #endif
OLDNEW
« no previous file with comments | « src/gpu/batches/GrTessellatingPathRenderer.cpp ('k') | src/gpu/effects/GrBezierEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698