| 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 715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 726 coverageType = Coverage::kAttribute_Type; | 726 coverageType = Coverage::kAttribute_Type; |
| 727 } | 727 } |
| 728 Coverage coverage(coverageType); | 728 Coverage coverage(coverageType); |
| 729 LocalCoords localCoords(usesLocalCoords ? LocalCoords::kUsePosition_Type : | 729 LocalCoords localCoords(usesLocalCoords ? LocalCoords::kUsePosition_Type : |
| 730 LocalCoords::kUnused_Type); | 730 LocalCoords::kUnused_Type); |
| 731 return CreateForDeviceSpace(color, coverage, localCoords, viewMatrix); | 731 return CreateForDeviceSpace(color, coverage, localCoords, viewMatrix); |
| 732 } | 732 } |
| 733 | 733 |
| 734 class AAConvexPathBatch : public GrVertexBatch { | 734 class AAConvexPathBatch : public GrVertexBatch { |
| 735 public: | 735 public: |
| 736 BATCH_CLASS_ID |
| 736 struct Geometry { | 737 struct Geometry { |
| 737 GrColor fColor; | 738 GrColor fColor; |
| 738 SkMatrix fViewMatrix; | 739 SkMatrix fViewMatrix; |
| 739 SkPath fPath; | 740 SkPath fPath; |
| 740 }; | 741 }; |
| 741 | 742 |
| 742 static GrDrawBatch* Create(const Geometry& geometry) { return new AAConvexPa
thBatch(geometry); } | 743 static GrDrawBatch* Create(const Geometry& geometry) { return new AAConvexPa
thBatch(geometry); } |
| 743 | 744 |
| 744 const char* name() const override { return "AAConvexBatch"; } | 745 const char* name() const override { return "AAConvexBatch"; } |
| 745 | 746 |
| 746 void getInvariantOutputColor(GrInitInvariantOutput* out) const override { | 747 void getInvariantOutputColor(GrInitInvariantOutput* out) const override { |
| 747 // When this is called on a batch, there is only one geometry bundle | 748 // When this is called on a batch, there is only one geometry bundle |
| 748 out->setKnownFourComponents(fGeoData[0].fColor); | 749 out->setKnownFourComponents(fGeoData[0].fColor); |
| 749 } | 750 } |
| 750 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { | 751 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { |
| 751 out->setUnknownSingleComponent(); | 752 out->setUnknownSingleComponent(); |
| 752 } | 753 } |
| 753 | 754 |
| 754 private: | 755 private: |
| 755 | |
| 756 void initBatchTracker(const GrPipelineOptimizations& opt) override { | 756 void initBatchTracker(const GrPipelineOptimizations& opt) override { |
| 757 // Handle any color overrides | 757 // Handle any color overrides |
| 758 if (!opt.readsColor()) { | 758 if (!opt.readsColor()) { |
| 759 fGeoData[0].fColor = GrColor_ILLEGAL; | 759 fGeoData[0].fColor = GrColor_ILLEGAL; |
| 760 } | 760 } |
| 761 opt.getOverrideColorIfSet(&fGeoData[0].fColor); | 761 opt.getOverrideColorIfSet(&fGeoData[0].fColor); |
| 762 | 762 |
| 763 // setup batch properties | 763 // setup batch properties |
| 764 fBatch.fColorIgnored = !opt.readsColor(); | 764 fBatch.fColorIgnored = !opt.readsColor(); |
| 765 fBatch.fColor = fGeoData[0].fColor; | 765 fBatch.fColor = fGeoData[0].fColor; |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1005 DRAW_BATCH_TEST_DEFINE(AAConvexPathBatch) { | 1005 DRAW_BATCH_TEST_DEFINE(AAConvexPathBatch) { |
| 1006 AAConvexPathBatch::Geometry geometry; | 1006 AAConvexPathBatch::Geometry geometry; |
| 1007 geometry.fColor = GrRandomColor(random); | 1007 geometry.fColor = GrRandomColor(random); |
| 1008 geometry.fViewMatrix = GrTest::TestMatrixInvertible(random); | 1008 geometry.fViewMatrix = GrTest::TestMatrixInvertible(random); |
| 1009 geometry.fPath = GrTest::TestPathConvex(random); | 1009 geometry.fPath = GrTest::TestPathConvex(random); |
| 1010 | 1010 |
| 1011 return AAConvexPathBatch::Create(geometry); | 1011 return AAConvexPathBatch::Create(geometry); |
| 1012 } | 1012 } |
| 1013 | 1013 |
| 1014 #endif | 1014 #endif |
| OLD | NEW |