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

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

Issue 1416423003: Make GrGLSLProgramBuilder base class for ProgramBuilder (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: nit Created 5 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
« no previous file with comments | « src/gpu/GrDefaultGeoProcFactory.cpp ('k') | src/gpu/GrPathProcessor.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 #include "GrOvalRenderer.h" 8 #include "GrOvalRenderer.h"
9 9
10 #include "GrBatchFlushState.h" 10 #include "GrBatchFlushState.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 88
89 inline bool isStroked() const { return fStroke; } 89 inline bool isStroked() const { return fStroke; }
90 90
91 class GLProcessor : public GrGLGeometryProcessor { 91 class GLProcessor : public GrGLGeometryProcessor {
92 public: 92 public:
93 GLProcessor() 93 GLProcessor()
94 : fColor(GrColor_ILLEGAL) {} 94 : fColor(GrColor_ILLEGAL) {}
95 95
96 void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override{ 96 void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override{
97 const CircleEdgeEffect& ce = args.fGP.cast<CircleEdgeEffect>(); 97 const CircleEdgeEffect& ce = args.fGP.cast<CircleEdgeEffect>();
98 GrGLGPBuilder* pb = args.fPB; 98 GrGLSLGPBuilder* pb = args.fPB;
99 GrGLVertexBuilder* vsBuilder = args.fPB->getVertexShaderBuilder(); 99 GrGLVertexBuilder* vsBuilder = args.fPB->getVertexShaderBuilder();
100 100
101 // emit attributes 101 // emit attributes
102 vsBuilder->emitAttributes(ce); 102 vsBuilder->emitAttributes(ce);
103 103
104 GrGLVertToFrag v(kVec4f_GrSLType); 104 GrGLSLVertToFrag v(kVec4f_GrSLType);
105 args.fPB->addVarying("CircleEdge", &v); 105 args.fPB->addVarying("CircleEdge", &v);
106 vsBuilder->codeAppendf("%s = %s;", v.vsOut(), ce.inCircleEdge()->fNa me); 106 vsBuilder->codeAppendf("%s = %s;", v.vsOut(), ce.inCircleEdge()->fNa me);
107 107
108 // setup pass through color 108 // setup pass through color
109 if (!ce.colorIgnored()) { 109 if (!ce.colorIgnored()) {
110 this->setupUniformColor(pb, args.fOutputColor, &fColorUniform); 110 this->setupUniformColor(pb, args.fOutputColor, &fColorUniform);
111 } 111 }
112 112
113 // Setup position 113 // Setup position
114 this->setupPosition(pb, gpArgs, ce.inPosition()->fName); 114 this->setupPosition(pb, gpArgs, ce.inPosition()->fName);
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 236
237 inline bool isStroked() const { return fStroke; } 237 inline bool isStroked() const { return fStroke; }
238 238
239 class GLProcessor : public GrGLGeometryProcessor { 239 class GLProcessor : public GrGLGeometryProcessor {
240 public: 240 public:
241 GLProcessor() 241 GLProcessor()
242 : fColor(GrColor_ILLEGAL) {} 242 : fColor(GrColor_ILLEGAL) {}
243 243
244 void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override{ 244 void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override{
245 const EllipseEdgeEffect& ee = args.fGP.cast<EllipseEdgeEffect>(); 245 const EllipseEdgeEffect& ee = args.fGP.cast<EllipseEdgeEffect>();
246 GrGLGPBuilder* pb = args.fPB; 246 GrGLSLGPBuilder* pb = args.fPB;
247 GrGLVertexBuilder* vsBuilder = args.fPB->getVertexShaderBuilder(); 247 GrGLVertexBuilder* vsBuilder = args.fPB->getVertexShaderBuilder();
248 248
249 // emit attributes 249 // emit attributes
250 vsBuilder->emitAttributes(ee); 250 vsBuilder->emitAttributes(ee);
251 251
252 GrGLVertToFrag ellipseOffsets(kVec2f_GrSLType); 252 GrGLSLVertToFrag ellipseOffsets(kVec2f_GrSLType);
253 args.fPB->addVarying("EllipseOffsets", &ellipseOffsets); 253 args.fPB->addVarying("EllipseOffsets", &ellipseOffsets);
254 vsBuilder->codeAppendf("%s = %s;", ellipseOffsets.vsOut(), 254 vsBuilder->codeAppendf("%s = %s;", ellipseOffsets.vsOut(),
255 ee.inEllipseOffset()->fName); 255 ee.inEllipseOffset()->fName);
256 256
257 GrGLVertToFrag ellipseRadii(kVec4f_GrSLType); 257 GrGLSLVertToFrag ellipseRadii(kVec4f_GrSLType);
258 args.fPB->addVarying("EllipseRadii", &ellipseRadii); 258 args.fPB->addVarying("EllipseRadii", &ellipseRadii);
259 vsBuilder->codeAppendf("%s = %s;", ellipseRadii.vsOut(), 259 vsBuilder->codeAppendf("%s = %s;", ellipseRadii.vsOut(),
260 ee.inEllipseRadii()->fName); 260 ee.inEllipseRadii()->fName);
261 261
262 // setup pass through color 262 // setup pass through color
263 if (!ee.colorIgnored()) { 263 if (!ee.colorIgnored()) {
264 this->setupUniformColor(pb, args.fOutputColor, &fColorUniform); 264 this->setupUniformColor(pb, args.fOutputColor, &fColorUniform);
265 } 265 }
266 266
267 // Setup position 267 // Setup position
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 411
412 inline Mode getMode() const { return fMode; } 412 inline Mode getMode() const { return fMode; }
413 413
414 class GLProcessor : public GrGLGeometryProcessor { 414 class GLProcessor : public GrGLGeometryProcessor {
415 public: 415 public:
416 GLProcessor() 416 GLProcessor()
417 : fViewMatrix(SkMatrix::InvalidMatrix()), fColor(GrColor_ILLEGAL) {} 417 : fViewMatrix(SkMatrix::InvalidMatrix()), fColor(GrColor_ILLEGAL) {}
418 418
419 void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override { 419 void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override {
420 const DIEllipseEdgeEffect& ee = args.fGP.cast<DIEllipseEdgeEffect>() ; 420 const DIEllipseEdgeEffect& ee = args.fGP.cast<DIEllipseEdgeEffect>() ;
421 GrGLGPBuilder* pb = args.fPB; 421 GrGLSLGPBuilder* pb = args.fPB;
422 GrGLVertexBuilder* vsBuilder = args.fPB->getVertexShaderBuilder(); 422 GrGLVertexBuilder* vsBuilder = args.fPB->getVertexShaderBuilder();
423 423
424 // emit attributes 424 // emit attributes
425 vsBuilder->emitAttributes(ee); 425 vsBuilder->emitAttributes(ee);
426 426
427 GrGLVertToFrag offsets0(kVec2f_GrSLType); 427 GrGLSLVertToFrag offsets0(kVec2f_GrSLType);
428 args.fPB->addVarying("EllipseOffsets0", &offsets0); 428 args.fPB->addVarying("EllipseOffsets0", &offsets0);
429 vsBuilder->codeAppendf("%s = %s;", offsets0.vsOut(), 429 vsBuilder->codeAppendf("%s = %s;", offsets0.vsOut(),
430 ee.inEllipseOffsets0()->fName); 430 ee.inEllipseOffsets0()->fName);
431 431
432 GrGLVertToFrag offsets1(kVec2f_GrSLType); 432 GrGLSLVertToFrag offsets1(kVec2f_GrSLType);
433 args.fPB->addVarying("EllipseOffsets1", &offsets1); 433 args.fPB->addVarying("EllipseOffsets1", &offsets1);
434 vsBuilder->codeAppendf("%s = %s;", offsets1.vsOut(), 434 vsBuilder->codeAppendf("%s = %s;", offsets1.vsOut(),
435 ee.inEllipseOffsets1()->fName); 435 ee.inEllipseOffsets1()->fName);
436 436
437 // setup pass through color 437 // setup pass through color
438 if (!ee.colorIgnored()) { 438 if (!ee.colorIgnored()) {
439 this->setupUniformColor(pb, args.fOutputColor, &fColorUniform); 439 this->setupUniformColor(pb, args.fOutputColor, &fColorUniform);
440 } 440 }
441 441
442 // Setup position 442 // Setup position
(...skipping 1587 matching lines...) Expand 10 before | Expand all | Expand 10 after
2030 } 2030 }
2031 2031
2032 DRAW_BATCH_TEST_DEFINE(RRectBatch) { 2032 DRAW_BATCH_TEST_DEFINE(RRectBatch) {
2033 SkMatrix viewMatrix = GrTest::TestMatrixRectStaysRect(random); 2033 SkMatrix viewMatrix = GrTest::TestMatrixRectStaysRect(random);
2034 GrColor color = GrRandomColor(random); 2034 GrColor color = GrRandomColor(random);
2035 const SkRRect& rrect = GrTest::TestRRectSimple(random); 2035 const SkRRect& rrect = GrTest::TestRRectSimple(random);
2036 return create_rrect_batch(color, viewMatrix, rrect, GrTest::TestStrokeRec(ra ndom)); 2036 return create_rrect_batch(color, viewMatrix, rrect, GrTest::TestStrokeRec(ra ndom));
2037 } 2037 }
2038 2038
2039 #endif 2039 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrDefaultGeoProcFactory.cpp ('k') | src/gpu/GrPathProcessor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698