OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "GrAAConvexPathRenderer.h" | 9 #include "GrAAConvexPathRenderer.h" |
10 | 10 |
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 | 520 |
521 const GrAttribute* inPosition() const { return fInPosition; } | 521 const GrAttribute* inPosition() const { return fInPosition; } |
522 const GrAttribute* inQuadEdge() const { return fInQuadEdge; } | 522 const GrAttribute* inQuadEdge() const { return fInQuadEdge; } |
523 | 523 |
524 virtual const GrBackendGeometryProcessorFactory& getFactory() const SK_OVERR
IDE { | 524 virtual const GrBackendGeometryProcessorFactory& getFactory() const SK_OVERR
IDE { |
525 return GrTBackendGeometryProcessorFactory<QuadEdgeEffect>::getInstance()
; | 525 return GrTBackendGeometryProcessorFactory<QuadEdgeEffect>::getInstance()
; |
526 } | 526 } |
527 | 527 |
528 class GLProcessor : public GrGLGeometryProcessor { | 528 class GLProcessor : public GrGLGeometryProcessor { |
529 public: | 529 public: |
530 GLProcessor(const GrBackendProcessorFactory& factory, | 530 GLProcessor(const GrBackendProcessorFactory& factory, const GrProcessor&
) |
531 const GrGeometryProcessor&, | |
532 const GrBatchTracker&) | |
533 : INHERITED (factory) {} | 531 : INHERITED (factory) {} |
534 | 532 |
535 virtual void emitCode(const EmitArgs& args) SK_OVERRIDE { | 533 virtual void emitCode(const EmitArgs& args) SK_OVERRIDE { |
536 const QuadEdgeEffect& qe = args.fGP.cast<QuadEdgeEffect>(); | 534 const QuadEdgeEffect& qe = args.fGP.cast<QuadEdgeEffect>(); |
537 GrGLVertexBuilder* vsBuilder = args.fPB->getVertexShaderBuilder(); | 535 GrGLVertexBuilder* vsBuilder = args.fPB->getVertexShaderBuilder(); |
538 | 536 |
539 GrGLVertToFrag v(kVec4f_GrSLType); | 537 GrGLVertToFrag v(kVec4f_GrSLType); |
540 args.fPB->addVarying("QuadEdge", &v); | 538 args.fPB->addVarying("QuadEdge", &v); |
541 vsBuilder->codeAppendf("%s = %s;", v.vsOut(), qe.inQuadEdge()->fName
); | 539 vsBuilder->codeAppendf("%s = %s;", v.vsOut(), qe.inQuadEdge()->fName
); |
542 | 540 |
(...skipping 23 matching lines...) Expand all Loading... |
566 " 2.0*%s.x*duvdy.x - duvdy.y);"
, | 564 " 2.0*%s.x*duvdy.x - duvdy.y);"
, |
567 v.fsIn(), v.fsIn()); | 565 v.fsIn(), v.fsIn()); |
568 fsBuilder->codeAppendf("edgeAlpha = (%s.x*%s.x - %s.y);", v.fsIn(),
v.fsIn(), | 566 fsBuilder->codeAppendf("edgeAlpha = (%s.x*%s.x - %s.y);", v.fsIn(),
v.fsIn(), |
569 v.fsIn()); | 567 v.fsIn()); |
570 fsBuilder->codeAppendf("edgeAlpha = " | 568 fsBuilder->codeAppendf("edgeAlpha = " |
571 "clamp(0.5 - edgeAlpha / length(gF), 0.0, 1.0
);}"); | 569 "clamp(0.5 - edgeAlpha / length(gF), 0.0, 1.0
);}"); |
572 | 570 |
573 fsBuilder->codeAppendf("%s = vec4(edgeAlpha);", args.fOutputCoverage
); | 571 fsBuilder->codeAppendf("%s = vec4(edgeAlpha);", args.fOutputCoverage
); |
574 } | 572 } |
575 | 573 |
576 static inline void GenKey(const GrGeometryProcessor&, | 574 static inline void GenKey(const GrProcessor&, const GrGLCaps&, GrProcess
orKeyBuilder*) {} |
577 const GrBatchTracker&, | |
578 const GrGLCaps&, | |
579 GrProcessorKeyBuilder*) {} | |
580 | 575 |
581 virtual void setData(const GrGLProgramDataManager&, | 576 virtual void setData(const GrGLProgramDataManager&, const GrProcessor&)
SK_OVERRIDE {} |
582 const GrGeometryProcessor&, | |
583 const GrBatchTracker&) SK_OVERRIDE {} | |
584 | 577 |
585 private: | 578 private: |
586 typedef GrGLGeometryProcessor INHERITED; | 579 typedef GrGLGeometryProcessor INHERITED; |
587 }; | 580 }; |
588 | 581 |
589 private: | 582 private: |
590 QuadEdgeEffect() { | 583 QuadEdgeEffect() { |
591 fInPosition = &this->addVertexAttrib(GrAttribute("inPosition", kVec2f_Gr
VertexAttribType)); | 584 fInPosition = &this->addVertexAttrib(GrAttribute("inPosition", kVec2f_Gr
VertexAttribType)); |
592 fInQuadEdge = &this->addVertexAttrib(GrAttribute("inQuadEdge", kVec4f_Gr
VertexAttribType)); | 585 fInQuadEdge = &this->addVertexAttrib(GrAttribute("inQuadEdge", kVec4f_Gr
VertexAttribType)); |
593 } | 586 } |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
712 vOffset, // start vertex | 705 vOffset, // start vertex |
713 0, // start index | 706 0, // start index |
714 draw.fVertexCnt, | 707 draw.fVertexCnt, |
715 draw.fIndexCnt, | 708 draw.fIndexCnt, |
716 &devBounds); | 709 &devBounds); |
717 vOffset += draw.fVertexCnt; | 710 vOffset += draw.fVertexCnt; |
718 } | 711 } |
719 | 712 |
720 return true; | 713 return true; |
721 } | 714 } |
OLD | NEW |