| 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 virtual const char* name() const SK_OVERRIDE { return "QuadEdge"; } | 527 virtual 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 virtual void emitCode(EmitArgs& args) SK_OVERRIDE { | 538 virtual void emitCode(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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 648 return CanCombineLocalMatrices(*this, mine.fUsesLocalCoords, | 648 return CanCombineLocalMatrices(*this, mine.fUsesLocalCoords, |
| 649 that, theirs.fUsesLocalCoords) && | 649 that, theirs.fUsesLocalCoords) && |
| 650 CanCombineOutput(mine.fInputColorType, mine.fColor, | 650 CanCombineOutput(mine.fInputColorType, mine.fColor, |
| 651 theirs.fInputColorType, theirs.fColor); | 651 theirs.fInputColorType, theirs.fColor); |
| 652 } | 652 } |
| 653 | 653 |
| 654 private: | 654 private: |
| 655 QuadEdgeEffect(GrColor color, const SkMatrix& localMatrix) | 655 QuadEdgeEffect(GrColor color, const SkMatrix& localMatrix) |
| 656 : INHERITED(color, SkMatrix::I(), localMatrix) { | 656 : INHERITED(color, SkMatrix::I(), localMatrix) { |
| 657 this->initClassID<QuadEdgeEffect>(); | 657 this->initClassID<QuadEdgeEffect>(); |
| 658 fInPosition = &this->addVertexAttrib(GrAttribute("inPosition", kVec2f_Gr
VertexAttribType)); | 658 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVe
rtexAttribType)); |
| 659 fInQuadEdge = &this->addVertexAttrib(GrAttribute("inQuadEdge", kVec4f_Gr
VertexAttribType)); | 659 fInQuadEdge = &this->addVertexAttrib(Attribute("inQuadEdge", kVec4f_GrVe
rtexAttribType)); |
| 660 } | 660 } |
| 661 | 661 |
| 662 virtual bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE { | 662 virtual bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE { |
| 663 return true; | 663 return true; |
| 664 } | 664 } |
| 665 | 665 |
| 666 virtual void onGetInvariantOutputCoverage(GrInitInvariantOutput* out) const
SK_OVERRIDE { | 666 virtual void onGetInvariantOutputCoverage(GrInitInvariantOutput* out) const
SK_OVERRIDE { |
| 667 out->setUnknownSingleComponent(); | 667 out->setUnknownSingleComponent(); |
| 668 } | 668 } |
| 669 | 669 |
| 670 struct BatchTracker { | 670 struct BatchTracker { |
| 671 GrGPInput fInputColorType; | 671 GrGPInput fInputColorType; |
| 672 GrColor fColor; | 672 GrColor fColor; |
| 673 bool fUsesLocalCoords; | 673 bool fUsesLocalCoords; |
| 674 }; | 674 }; |
| 675 | 675 |
| 676 const GrAttribute* fInPosition; | 676 const Attribute* fInPosition; |
| 677 const GrAttribute* fInQuadEdge; | 677 const Attribute* fInQuadEdge; |
| 678 | 678 |
| 679 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; | 679 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; |
| 680 | 680 |
| 681 typedef GrGeometryProcessor INHERITED; | 681 typedef GrGeometryProcessor INHERITED; |
| 682 }; | 682 }; |
| 683 | 683 |
| 684 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(QuadEdgeEffect); | 684 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(QuadEdgeEffect); |
| 685 | 685 |
| 686 GrGeometryProcessor* QuadEdgeEffect::TestCreate(SkRandom* random, | 686 GrGeometryProcessor* QuadEdgeEffect::TestCreate(SkRandom* random, |
| 687 GrContext*, | 687 GrContext*, |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 790 vOffset, // start vertex | 790 vOffset, // start vertex |
| 791 0, // start index | 791 0, // start index |
| 792 draw.fVertexCnt, | 792 draw.fVertexCnt, |
| 793 draw.fIndexCnt, | 793 draw.fIndexCnt, |
| 794 &devBounds); | 794 &devBounds); |
| 795 vOffset += draw.fVertexCnt; | 795 vOffset += draw.fVertexCnt; |
| 796 } | 796 } |
| 797 | 797 |
| 798 return true; | 798 return true; |
| 799 } | 799 } |
| OLD | NEW |