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 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 public: | 519 public: |
520 | 520 |
521 static GrGeometryProcessor* Create(GrColor color, const SkMatrix& localMatri
x) { | 521 static GrGeometryProcessor* Create(GrColor color, const SkMatrix& localMatri
x) { |
522 return SkNEW_ARGS(QuadEdgeEffect, (color, localMatrix)); | 522 return SkNEW_ARGS(QuadEdgeEffect, (color, localMatrix)); |
523 } | 523 } |
524 | 524 |
525 virtual ~QuadEdgeEffect() {} | 525 virtual ~QuadEdgeEffect() {} |
526 | 526 |
527 const char* name() const SK_OVERRIDE { return "QuadEdge"; } | 527 const char* name() const SK_OVERRIDE { return "QuadEdge"; } |
528 | 528 |
529 const GrAttribute* inPosition() const { return fInPosition; } | 529 const Attribute* inPosition() const { return fInPosition; } |
530 const GrAttribute* inQuadEdge() const { return fInQuadEdge; } | 530 const Attribute* inQuadEdge() const { return fInQuadEdge; } |
531 | 531 |
532 class GLProcessor : public GrGLGeometryProcessor { | 532 class GLProcessor : public GrGLGeometryProcessor { |
533 public: | 533 public: |
534 GLProcessor(const GrGeometryProcessor&, | 534 GLProcessor(const GrGeometryProcessor&, |
535 const GrBatchTracker&) | 535 const GrBatchTracker&) |
536 : fColor(GrColor_ILLEGAL) {} | 536 : fColor(GrColor_ILLEGAL) {} |
537 | 537 |
538 void onEmitCode(EmitArgs& args) SK_OVERRIDE { | 538 void onEmitCode(EmitArgs& args) SK_OVERRIDE { |
539 const QuadEdgeEffect& qe = args.fGP.cast<QuadEdgeEffect>(); | 539 const QuadEdgeEffect& qe = args.fGP.cast<QuadEdgeEffect>(); |
540 GrGLGPBuilder* pb = args.fPB; | 540 GrGLGPBuilder* pb = args.fPB; |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
644 return CanCombineLocalMatrices(*this, mine.fUsesLocalCoords, | 644 return CanCombineLocalMatrices(*this, mine.fUsesLocalCoords, |
645 that, theirs.fUsesLocalCoords) && | 645 that, theirs.fUsesLocalCoords) && |
646 CanCombineOutput(mine.fInputColorType, mine.fColor, | 646 CanCombineOutput(mine.fInputColorType, mine.fColor, |
647 theirs.fInputColorType, theirs.fColor); | 647 theirs.fInputColorType, theirs.fColor); |
648 } | 648 } |
649 | 649 |
650 private: | 650 private: |
651 QuadEdgeEffect(GrColor color, const SkMatrix& localMatrix) | 651 QuadEdgeEffect(GrColor color, const SkMatrix& localMatrix) |
652 : INHERITED(color, SkMatrix::I(), localMatrix) { | 652 : INHERITED(color, SkMatrix::I(), localMatrix) { |
653 this->initClassID<QuadEdgeEffect>(); | 653 this->initClassID<QuadEdgeEffect>(); |
654 fInPosition = &this->addVertexAttrib(GrAttribute("inPosition", kVec2f_Gr
VertexAttribType)); | 654 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVe
rtexAttribType)); |
655 fInQuadEdge = &this->addVertexAttrib(GrAttribute("inQuadEdge", kVec4f_Gr
VertexAttribType)); | 655 fInQuadEdge = &this->addVertexAttrib(Attribute("inQuadEdge", kVec4f_GrVe
rtexAttribType)); |
656 } | 656 } |
657 | 657 |
658 bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE { | 658 bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE { |
659 return true; | 659 return true; |
660 } | 660 } |
661 | 661 |
662 void onGetInvariantOutputCoverage(GrInitInvariantOutput* out) const SK_OVERR
IDE { | 662 void onGetInvariantOutputCoverage(GrInitInvariantOutput* out) const SK_OVERR
IDE { |
663 out->setUnknownSingleComponent(); | 663 out->setUnknownSingleComponent(); |
664 } | 664 } |
665 | 665 |
666 struct BatchTracker { | 666 struct BatchTracker { |
667 GrGPInput fInputColorType; | 667 GrGPInput fInputColorType; |
668 GrColor fColor; | 668 GrColor fColor; |
669 bool fUsesLocalCoords; | 669 bool fUsesLocalCoords; |
670 }; | 670 }; |
671 | 671 |
672 const GrAttribute* fInPosition; | 672 const Attribute* fInPosition; |
673 const GrAttribute* fInQuadEdge; | 673 const Attribute* fInQuadEdge; |
674 | 674 |
675 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; | 675 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; |
676 | 676 |
677 typedef GrGeometryProcessor INHERITED; | 677 typedef GrGeometryProcessor INHERITED; |
678 }; | 678 }; |
679 | 679 |
680 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(QuadEdgeEffect); | 680 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(QuadEdgeEffect); |
681 | 681 |
682 GrGeometryProcessor* QuadEdgeEffect::TestCreate(SkRandom* random, | 682 GrGeometryProcessor* QuadEdgeEffect::TestCreate(SkRandom* random, |
683 GrContext*, | 683 GrContext*, |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
786 vOffset, // start vertex | 786 vOffset, // start vertex |
787 0, // start index | 787 0, // start index |
788 draw.fVertexCnt, | 788 draw.fVertexCnt, |
789 draw.fIndexCnt, | 789 draw.fIndexCnt, |
790 &devBounds); | 790 &devBounds); |
791 vOffset += draw.fVertexCnt; | 791 vOffset += draw.fVertexCnt; |
792 } | 792 } |
793 | 793 |
794 return true; | 794 return true; |
795 } | 795 } |
OLD | NEW |