| 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 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 528 static GrGeometryProcessor* Create(GrColor color, const SkMatrix& localMatri
x) { | 528 static GrGeometryProcessor* Create(GrColor color, const SkMatrix& localMatri
x) { |
| 529 return SkNEW_ARGS(QuadEdgeEffect, (color, localMatrix)); | 529 return SkNEW_ARGS(QuadEdgeEffect, (color, localMatrix)); |
| 530 } | 530 } |
| 531 | 531 |
| 532 virtual ~QuadEdgeEffect() {} | 532 virtual ~QuadEdgeEffect() {} |
| 533 | 533 |
| 534 const char* name() const override { return "QuadEdge"; } | 534 const char* name() const override { return "QuadEdge"; } |
| 535 | 535 |
| 536 const Attribute* inPosition() const { return fInPosition; } | 536 const Attribute* inPosition() const { return fInPosition; } |
| 537 const Attribute* inQuadEdge() const { return fInQuadEdge; } | 537 const Attribute* inQuadEdge() const { return fInQuadEdge; } |
| 538 GrColor color() const { return fColor; } |
| 538 | 539 |
| 539 class GLProcessor : public GrGLGeometryProcessor { | 540 class GLProcessor : public GrGLGeometryProcessor { |
| 540 public: | 541 public: |
| 541 GLProcessor(const GrGeometryProcessor&, | 542 GLProcessor(const GrGeometryProcessor&, |
| 542 const GrBatchTracker&) | 543 const GrBatchTracker&) |
| 543 : fColor(GrColor_ILLEGAL) {} | 544 : fColor(GrColor_ILLEGAL) {} |
| 544 | 545 |
| 545 void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override { | 546 void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override { |
| 546 const QuadEdgeEffect& qe = args.fGP.cast<QuadEdgeEffect>(); | 547 const QuadEdgeEffect& qe = args.fGP.cast<QuadEdgeEffect>(); |
| 547 GrGLGPBuilder* pb = args.fPB; | 548 GrGLGPBuilder* pb = args.fPB; |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 636 } | 637 } |
| 637 | 638 |
| 638 void initBatchTracker(GrBatchTracker* bt, const GrPipelineInfo& init) const
override { | 639 void initBatchTracker(GrBatchTracker* bt, const GrPipelineInfo& init) const
override { |
| 639 BatchTracker* local = bt->cast<BatchTracker>(); | 640 BatchTracker* local = bt->cast<BatchTracker>(); |
| 640 local->fInputColorType = GetColorInputType(&local->fColor, this->color()
, init, false); | 641 local->fInputColorType = GetColorInputType(&local->fColor, this->color()
, init, false); |
| 641 local->fUsesLocalCoords = init.fUsesLocalCoords; | 642 local->fUsesLocalCoords = init.fUsesLocalCoords; |
| 642 } | 643 } |
| 643 | 644 |
| 644 private: | 645 private: |
| 645 QuadEdgeEffect(GrColor color, const SkMatrix& localMatrix) | 646 QuadEdgeEffect(GrColor color, const SkMatrix& localMatrix) |
| 646 : INHERITED(color, SkMatrix::I(), localMatrix) { | 647 : INHERITED(SkMatrix::I(), localMatrix) |
| 648 , fColor(color) { |
| 647 this->initClassID<QuadEdgeEffect>(); | 649 this->initClassID<QuadEdgeEffect>(); |
| 648 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVe
rtexAttribType)); | 650 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVe
rtexAttribType)); |
| 649 fInQuadEdge = &this->addVertexAttrib(Attribute("inQuadEdge", kVec4f_GrVe
rtexAttribType)); | 651 fInQuadEdge = &this->addVertexAttrib(Attribute("inQuadEdge", kVec4f_GrVe
rtexAttribType)); |
| 650 } | 652 } |
| 651 | 653 |
| 652 struct BatchTracker { | 654 struct BatchTracker { |
| 653 GrGPInput fInputColorType; | 655 GrGPInput fInputColorType; |
| 654 GrColor fColor; | 656 GrColor fColor; |
| 655 bool fUsesLocalCoords; | 657 bool fUsesLocalCoords; |
| 656 }; | 658 }; |
| 657 | 659 |
| 658 const Attribute* fInPosition; | 660 const Attribute* fInPosition; |
| 659 const Attribute* fInQuadEdge; | 661 const Attribute* fInQuadEdge; |
| 662 GrColor fColor; |
| 660 | 663 |
| 661 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; | 664 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; |
| 662 | 665 |
| 663 typedef GrGeometryProcessor INHERITED; | 666 typedef GrGeometryProcessor INHERITED; |
| 664 }; | 667 }; |
| 665 | 668 |
| 666 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(QuadEdgeEffect); | 669 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(QuadEdgeEffect); |
| 667 | 670 |
| 668 GrGeometryProcessor* QuadEdgeEffect::TestCreate(SkRandom* random, | 671 GrGeometryProcessor* QuadEdgeEffect::TestCreate(SkRandom* random, |
| 669 GrContext*, | 672 GrContext*, |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1025 BATCH_TEST_DEFINE(AAConvexPath) { | 1028 BATCH_TEST_DEFINE(AAConvexPath) { |
| 1026 AAConvexPathBatch::Geometry geometry; | 1029 AAConvexPathBatch::Geometry geometry; |
| 1027 geometry.fColor = GrRandomColor(random); | 1030 geometry.fColor = GrRandomColor(random); |
| 1028 geometry.fViewMatrix = GrTest::TestMatrix(random); | 1031 geometry.fViewMatrix = GrTest::TestMatrix(random); |
| 1029 geometry.fPath = GrTest::TestPathConvex(random); | 1032 geometry.fPath = GrTest::TestPathConvex(random); |
| 1030 | 1033 |
| 1031 return AAConvexPathBatch::Create(geometry); | 1034 return AAConvexPathBatch::Create(geometry); |
| 1032 } | 1035 } |
| 1033 | 1036 |
| 1034 #endif | 1037 #endif |
| OLD | NEW |