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

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

Issue 1443743002: Rename some processor functions from GL to GLSL (Closed) Base URL: https://skia.googlesource.com/skia.git@primProcs
Patch Set: nits 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/GrFragmentProcessor.cpp ('k') | src/gpu/GrPathProcessor.h » ('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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 GrColor color() const { return fColor; } 83 GrColor color() const { return fColor; }
84 bool colorIgnored() const { return GrColor_ILLEGAL == fColor; } 84 bool colorIgnored() const { return GrColor_ILLEGAL == fColor; }
85 const SkMatrix& localMatrix() const { return fLocalMatrix; } 85 const SkMatrix& localMatrix() const { return fLocalMatrix; }
86 bool usesLocalCoords() const { return fUsesLocalCoords; } 86 bool usesLocalCoords() const { return fUsesLocalCoords; }
87 virtual ~CircleEdgeEffect() {} 87 virtual ~CircleEdgeEffect() {}
88 88
89 const char* name() const override { return "CircleEdge"; } 89 const char* name() const override { return "CircleEdge"; }
90 90
91 inline bool isStroked() const { return fStroke; } 91 inline bool isStroked() const { return fStroke; }
92 92
93 class GLProcessor : public GrGLSLGeometryProcessor { 93 class GLSLProcessor : public GrGLSLGeometryProcessor {
94 public: 94 public:
95 GLProcessor() 95 GLSLProcessor()
96 : fColor(GrColor_ILLEGAL) {} 96 : fColor(GrColor_ILLEGAL) {}
97 97
98 void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override{ 98 void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override{
99 const CircleEdgeEffect& ce = args.fGP.cast<CircleEdgeEffect>(); 99 const CircleEdgeEffect& ce = args.fGP.cast<CircleEdgeEffect>();
100 GrGLSLGPBuilder* pb = args.fPB; 100 GrGLSLGPBuilder* pb = args.fPB;
101 GrGLSLVertexBuilder* vsBuilder = args.fPB->getVertexShaderBuilder(); 101 GrGLSLVertexBuilder* vsBuilder = args.fPB->getVertexShaderBuilder();
102 102
103 // emit attributes 103 // emit attributes
104 vsBuilder->emitAttributes(ce); 104 vsBuilder->emitAttributes(ce);
105 105
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 const SkTArray<const GrCoordTransform*, true>& tra nsforms) override { 158 const SkTArray<const GrCoordTransform*, true>& tra nsforms) override {
159 this->setTransformDataHelper<CircleEdgeEffect>(primProc, pdman, inde x, transforms); 159 this->setTransformDataHelper<CircleEdgeEffect>(primProc, pdman, inde x, transforms);
160 } 160 }
161 161
162 private: 162 private:
163 GrColor fColor; 163 GrColor fColor;
164 UniformHandle fColorUniform; 164 UniformHandle fColorUniform;
165 typedef GrGLSLGeometryProcessor INHERITED; 165 typedef GrGLSLGeometryProcessor INHERITED;
166 }; 166 };
167 167
168 void getGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) con st override { 168 void getGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) c onst override {
169 GLProcessor::GenKey(*this, caps, b); 169 GLSLProcessor::GenKey(*this, caps, b);
170 } 170 }
171 171
172 GrGLSLPrimitiveProcessor* createGLInstance(const GrGLSLCaps&) const override { 172 GrGLSLPrimitiveProcessor* createGLSLInstance(const GrGLSLCaps&) const overri de {
173 return new GLProcessor(); 173 return new GLSLProcessor();
174 } 174 }
175 175
176 private: 176 private:
177 CircleEdgeEffect(GrColor color, bool stroke, const SkMatrix& localMatrix, bo ol usesLocalCoords) 177 CircleEdgeEffect(GrColor color, bool stroke, const SkMatrix& localMatrix, bo ol usesLocalCoords)
178 : fColor(color) 178 : fColor(color)
179 , fLocalMatrix(localMatrix) 179 , fLocalMatrix(localMatrix)
180 , fUsesLocalCoords(usesLocalCoords) { 180 , fUsesLocalCoords(usesLocalCoords) {
181 this->initClassID<CircleEdgeEffect>(); 181 this->initClassID<CircleEdgeEffect>();
182 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVe rtexAttribType, 182 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVe rtexAttribType,
183 kHigh_GrSLPrecision)); 183 kHigh_GrSLPrecision));
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 const Attribute* inPosition() const { return fInPosition; } 231 const Attribute* inPosition() const { return fInPosition; }
232 const Attribute* inEllipseOffset() const { return fInEllipseOffset; } 232 const Attribute* inEllipseOffset() const { return fInEllipseOffset; }
233 const Attribute* inEllipseRadii() const { return fInEllipseRadii; } 233 const Attribute* inEllipseRadii() const { return fInEllipseRadii; }
234 GrColor color() const { return fColor; } 234 GrColor color() const { return fColor; }
235 bool colorIgnored() const { return GrColor_ILLEGAL == fColor; } 235 bool colorIgnored() const { return GrColor_ILLEGAL == fColor; }
236 const SkMatrix& localMatrix() const { return fLocalMatrix; } 236 const SkMatrix& localMatrix() const { return fLocalMatrix; }
237 bool usesLocalCoords() const { return fUsesLocalCoords; } 237 bool usesLocalCoords() const { return fUsesLocalCoords; }
238 238
239 inline bool isStroked() const { return fStroke; } 239 inline bool isStroked() const { return fStroke; }
240 240
241 class GLProcessor : public GrGLSLGeometryProcessor { 241 class GLSLProcessor : public GrGLSLGeometryProcessor {
242 public: 242 public:
243 GLProcessor() 243 GLSLProcessor()
244 : fColor(GrColor_ILLEGAL) {} 244 : fColor(GrColor_ILLEGAL) {}
245 245
246 void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override{ 246 void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override{
247 const EllipseEdgeEffect& ee = args.fGP.cast<EllipseEdgeEffect>(); 247 const EllipseEdgeEffect& ee = args.fGP.cast<EllipseEdgeEffect>();
248 GrGLSLGPBuilder* pb = args.fPB; 248 GrGLSLGPBuilder* pb = args.fPB;
249 GrGLSLVertexBuilder* vsBuilder = args.fPB->getVertexShaderBuilder(); 249 GrGLSLVertexBuilder* vsBuilder = args.fPB->getVertexShaderBuilder();
250 250
251 // emit attributes 251 // emit attributes
252 vsBuilder->emitAttributes(ee); 252 vsBuilder->emitAttributes(ee);
253 253
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 this->setTransformDataHelper<EllipseEdgeEffect>(primProc, pdman, ind ex, transforms); 327 this->setTransformDataHelper<EllipseEdgeEffect>(primProc, pdman, ind ex, transforms);
328 } 328 }
329 329
330 private: 330 private:
331 GrColor fColor; 331 GrColor fColor;
332 UniformHandle fColorUniform; 332 UniformHandle fColorUniform;
333 333
334 typedef GrGLSLGeometryProcessor INHERITED; 334 typedef GrGLSLGeometryProcessor INHERITED;
335 }; 335 };
336 336
337 void getGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) con st override { 337 void getGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) c onst override {
338 GLProcessor::GenKey(*this, caps, b); 338 GLSLProcessor::GenKey(*this, caps, b);
339 } 339 }
340 340
341 GrGLSLPrimitiveProcessor* createGLInstance(const GrGLSLCaps&) const override { 341 GrGLSLPrimitiveProcessor* createGLSLInstance(const GrGLSLCaps&) const overri de {
342 return new GLProcessor(); 342 return new GLSLProcessor();
343 } 343 }
344 344
345 private: 345 private:
346 EllipseEdgeEffect(GrColor color, bool stroke, const SkMatrix& localMatrix, 346 EllipseEdgeEffect(GrColor color, bool stroke, const SkMatrix& localMatrix,
347 bool usesLocalCoords) 347 bool usesLocalCoords)
348 : fColor(color) 348 : fColor(color)
349 , fLocalMatrix(localMatrix) 349 , fLocalMatrix(localMatrix)
350 , fUsesLocalCoords(usesLocalCoords) { 350 , fUsesLocalCoords(usesLocalCoords) {
351 this->initClassID<EllipseEdgeEffect>(); 351 this->initClassID<EllipseEdgeEffect>();
352 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVe rtexAttribType)); 352 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVe rtexAttribType));
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 const Attribute* inPosition() const { return fInPosition; } 406 const Attribute* inPosition() const { return fInPosition; }
407 const Attribute* inEllipseOffsets0() const { return fInEllipseOffsets0; } 407 const Attribute* inEllipseOffsets0() const { return fInEllipseOffsets0; }
408 const Attribute* inEllipseOffsets1() const { return fInEllipseOffsets1; } 408 const Attribute* inEllipseOffsets1() const { return fInEllipseOffsets1; }
409 GrColor color() const { return fColor; } 409 GrColor color() const { return fColor; }
410 bool colorIgnored() const { return GrColor_ILLEGAL == fColor; } 410 bool colorIgnored() const { return GrColor_ILLEGAL == fColor; }
411 const SkMatrix& viewMatrix() const { return fViewMatrix; } 411 const SkMatrix& viewMatrix() const { return fViewMatrix; }
412 bool usesLocalCoords() const { return fUsesLocalCoords; } 412 bool usesLocalCoords() const { return fUsesLocalCoords; }
413 413
414 inline Mode getMode() const { return fMode; } 414 inline Mode getMode() const { return fMode; }
415 415
416 class GLProcessor : public GrGLSLGeometryProcessor { 416 class GLSLProcessor : public GrGLSLGeometryProcessor {
417 public: 417 public:
418 GLProcessor() 418 GLSLProcessor()
419 : fViewMatrix(SkMatrix::InvalidMatrix()), fColor(GrColor_ILLEGAL) {} 419 : fViewMatrix(SkMatrix::InvalidMatrix()), fColor(GrColor_ILLEGAL) {}
420 420
421 void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override { 421 void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override {
422 const DIEllipseEdgeEffect& ee = args.fGP.cast<DIEllipseEdgeEffect>() ; 422 const DIEllipseEdgeEffect& ee = args.fGP.cast<DIEllipseEdgeEffect>() ;
423 GrGLSLGPBuilder* pb = args.fPB; 423 GrGLSLGPBuilder* pb = args.fPB;
424 GrGLSLVertexBuilder* vsBuilder = args.fPB->getVertexShaderBuilder(); 424 GrGLSLVertexBuilder* vsBuilder = args.fPB->getVertexShaderBuilder();
425 425
426 // emit attributes 426 // emit attributes
427 vsBuilder->emitAttributes(ee); 427 vsBuilder->emitAttributes(ee);
428 428
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 521
522 private: 522 private:
523 SkMatrix fViewMatrix; 523 SkMatrix fViewMatrix;
524 GrColor fColor; 524 GrColor fColor;
525 UniformHandle fColorUniform; 525 UniformHandle fColorUniform;
526 UniformHandle fViewMatrixUniform; 526 UniformHandle fViewMatrixUniform;
527 527
528 typedef GrGLSLGeometryProcessor INHERITED; 528 typedef GrGLSLGeometryProcessor INHERITED;
529 }; 529 };
530 530
531 void getGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) con st override { 531 void getGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) c onst override {
532 GLProcessor::GenKey(*this, caps, b); 532 GLSLProcessor::GenKey(*this, caps, b);
533 } 533 }
534 534
535 GrGLSLPrimitiveProcessor* createGLInstance(const GrGLSLCaps&) const override { 535 GrGLSLPrimitiveProcessor* createGLSLInstance(const GrGLSLCaps&) const overri de {
536 return new GLProcessor(); 536 return new GLSLProcessor();
537 } 537 }
538 538
539 private: 539 private:
540 DIEllipseEdgeEffect(GrColor color, const SkMatrix& viewMatrix, Mode mode, 540 DIEllipseEdgeEffect(GrColor color, const SkMatrix& viewMatrix, Mode mode,
541 bool usesLocalCoords) 541 bool usesLocalCoords)
542 : fColor(color) 542 : fColor(color)
543 , fViewMatrix(viewMatrix) 543 , fViewMatrix(viewMatrix)
544 , fUsesLocalCoords(usesLocalCoords) { 544 , fUsesLocalCoords(usesLocalCoords) {
545 this->initClassID<DIEllipseEdgeEffect>(); 545 this->initClassID<DIEllipseEdgeEffect>();
546 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVe rtexAttribType, 546 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVe rtexAttribType,
(...skipping 1485 matching lines...) Expand 10 before | Expand all | Expand 10 after
2032 } 2032 }
2033 2033
2034 DRAW_BATCH_TEST_DEFINE(RRectBatch) { 2034 DRAW_BATCH_TEST_DEFINE(RRectBatch) {
2035 SkMatrix viewMatrix = GrTest::TestMatrixRectStaysRect(random); 2035 SkMatrix viewMatrix = GrTest::TestMatrixRectStaysRect(random);
2036 GrColor color = GrRandomColor(random); 2036 GrColor color = GrRandomColor(random);
2037 const SkRRect& rrect = GrTest::TestRRectSimple(random); 2037 const SkRRect& rrect = GrTest::TestRRectSimple(random);
2038 return create_rrect_batch(color, viewMatrix, rrect, GrTest::TestStrokeRec(ra ndom)); 2038 return create_rrect_batch(color, viewMatrix, rrect, GrTest::TestStrokeRec(ra ndom));
2039 } 2039 }
2040 2040
2041 #endif 2041 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrFragmentProcessor.cpp ('k') | src/gpu/GrPathProcessor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698