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

Side by Side Diff: src/gpu/GrOvalRenderer.cpp

Issue 699943003: Move GrInvariantOutput out of GrProcessor and into its own class. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 1 month 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
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 #include "GrOvalRenderer.h" 8 #include "GrOvalRenderer.h"
9 9
10 #include "gl/builders/GrGLProgramBuilder.h" 10 #include "gl/builders/GrGLProgramBuilder.h"
11 #include "gl/GrGLProcessor.h" 11 #include "gl/GrGLProcessor.h"
12 #include "gl/GrGLSL.h" 12 #include "gl/GrGLSL.h"
13 #include "gl/GrGLGeometryProcessor.h" 13 #include "gl/GrGLGeometryProcessor.h"
14 #include "GrProcessor.h" 14 #include "GrProcessor.h"
15 #include "GrTBackendProcessorFactory.h" 15 #include "GrTBackendProcessorFactory.h"
16 16
17 #include "GrDrawState.h" 17 #include "GrDrawState.h"
18 #include "GrDrawTarget.h" 18 #include "GrDrawTarget.h"
19 #include "GrGpu.h" 19 #include "GrGpu.h"
20 #include "GrInvariantOutput.h"
20 21
21 #include "SkRRect.h" 22 #include "SkRRect.h"
22 #include "SkStrokeRec.h" 23 #include "SkStrokeRec.h"
23 #include "SkTLazy.h" 24 #include "SkTLazy.h"
24 25
25 #include "GrGeometryProcessor.h" 26 #include "GrGeometryProcessor.h"
26 #include "effects/GrRRectEffect.h" 27 #include "effects/GrRRectEffect.h"
27 28
28 namespace { 29 namespace {
29 // TODO(joshualitt) add per vertex colors 30 // TODO(joshualitt) add per vertex colors
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 kVec4f_GrSLType, 134 kVec4f_GrSLType,
134 GrShaderVar::kAttribute_TypeModifier))) { 135 GrShaderVar::kAttribute_TypeModifier))) {
135 fStroke = stroke; 136 fStroke = stroke;
136 } 137 }
137 138
138 virtual bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE { 139 virtual bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE {
139 const CircleEdgeEffect& cee = other.cast<CircleEdgeEffect>(); 140 const CircleEdgeEffect& cee = other.cast<CircleEdgeEffect>();
140 return cee.fStroke == fStroke; 141 return cee.fStroke == fStroke;
141 } 142 }
142 143
143 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR IDE { 144 virtual void onComputeInvariantOutput(GrInvariantOutput* inout) const SK_OVE RRIDE {
144 inout->mulByUnknownAlpha(); 145 inout->mulByUnknownAlpha();
145 } 146 }
146 147
147 const GrShaderVar& fInCircleEdge; 148 const GrShaderVar& fInCircleEdge;
148 bool fStroke; 149 bool fStroke;
149 150
150 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; 151 GR_DECLARE_GEOMETRY_PROCESSOR_TEST;
151 152
152 typedef GrGeometryProcessor INHERITED; 153 typedef GrGeometryProcessor INHERITED;
153 }; 154 };
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 kVec4f_GrSLType, 272 kVec4f_GrSLType,
272 GrShaderVar::kAttribute_TypeModifier))) { 273 GrShaderVar::kAttribute_TypeModifier))) {
273 fStroke = stroke; 274 fStroke = stroke;
274 } 275 }
275 276
276 virtual bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE { 277 virtual bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE {
277 const EllipseEdgeEffect& eee = other.cast<EllipseEdgeEffect>(); 278 const EllipseEdgeEffect& eee = other.cast<EllipseEdgeEffect>();
278 return eee.fStroke == fStroke; 279 return eee.fStroke == fStroke;
279 } 280 }
280 281
281 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR IDE { 282 virtual void onComputeInvariantOutput(GrInvariantOutput* inout) const SK_OVE RRIDE {
282 inout->mulByUnknownAlpha(); 283 inout->mulByUnknownAlpha();
283 } 284 }
284 285
285 const GrShaderVar& fInEllipseOffset; 286 const GrShaderVar& fInEllipseOffset;
286 const GrShaderVar& fInEllipseRadii; 287 const GrShaderVar& fInEllipseRadii;
287 bool fStroke; 288 bool fStroke;
288 289
289 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; 290 GR_DECLARE_GEOMETRY_PROCESSOR_TEST;
290 291
291 typedef GrGeometryProcessor INHERITED; 292 typedef GrGeometryProcessor INHERITED;
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 kVec2f_GrSLType, 433 kVec2f_GrSLType,
433 GrShaderVar::kAttribute_TypeModifier))) { 434 GrShaderVar::kAttribute_TypeModifier))) {
434 fMode = mode; 435 fMode = mode;
435 } 436 }
436 437
437 virtual bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE { 438 virtual bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE {
438 const DIEllipseEdgeEffect& eee = other.cast<DIEllipseEdgeEffect>(); 439 const DIEllipseEdgeEffect& eee = other.cast<DIEllipseEdgeEffect>();
439 return eee.fMode == fMode; 440 return eee.fMode == fMode;
440 } 441 }
441 442
442 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR IDE { 443 virtual void onComputeInvariantOutput(GrInvariantOutput* inout) const SK_OVE RRIDE {
443 inout->mulByUnknownAlpha(); 444 inout->mulByUnknownAlpha();
444 } 445 }
445 446
446 const GrShaderVar& fInEllipseOffsets0; 447 const GrShaderVar& fInEllipseOffsets0;
447 const GrShaderVar& fInEllipseOffsets1; 448 const GrShaderVar& fInEllipseOffsets1;
448 Mode fMode; 449 Mode fMode;
449 450
450 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; 451 GR_DECLARE_GEOMETRY_PROCESSOR_TEST;
451 452
452 typedef GrGeometryProcessor INHERITED; 453 typedef GrGeometryProcessor INHERITED;
(...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after
1239 // drop out the middle quad if we're stroked 1240 // drop out the middle quad if we're stroked
1240 int indexCnt = isStrokeOnly ? SK_ARRAY_COUNT(gRRectIndices) - 6 : 1241 int indexCnt = isStrokeOnly ? SK_ARRAY_COUNT(gRRectIndices) - 6 :
1241 SK_ARRAY_COUNT(gRRectIndices); 1242 SK_ARRAY_COUNT(gRRectIndices);
1242 target->setIndexSourceToBuffer(indexBuffer); 1243 target->setIndexSourceToBuffer(indexBuffer);
1243 target->drawIndexedInstances(kTriangles_GrPrimitiveType, 1, 16, indexCnt , &bounds); 1244 target->drawIndexedInstances(kTriangles_GrPrimitiveType, 1, 16, indexCnt , &bounds);
1244 } 1245 }
1245 1246
1246 target->resetIndexSource(); 1247 target->resetIndexSource();
1247 return true; 1248 return true;
1248 } 1249 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698