| 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 734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 745 struct Geometry { | 745 struct Geometry { |
| 746 GrColor fColor; | 746 GrColor fColor; |
| 747 SkMatrix fViewMatrix; | 747 SkMatrix fViewMatrix; |
| 748 SkPath fPath; | 748 SkPath fPath; |
| 749 }; | 749 }; |
| 750 | 750 |
| 751 static GrDrawBatch* Create(const Geometry& geometry) { return new AAConvexPa
thBatch(geometry); } | 751 static GrDrawBatch* Create(const Geometry& geometry) { return new AAConvexPa
thBatch(geometry); } |
| 752 | 752 |
| 753 const char* name() const override { return "AAConvexBatch"; } | 753 const char* name() const override { return "AAConvexBatch"; } |
| 754 | 754 |
| 755 void getInvariantOutputColor(GrInitInvariantOutput* out) const override { | 755 void computePipelineOptimizations(GrInitInvariantOutput* color, |
| 756 GrInitInvariantOutput* coverage, |
| 757 GrBatchToXPOverrides* overrides) const ove
rride { |
| 756 // When this is called on a batch, there is only one geometry bundle | 758 // When this is called on a batch, there is only one geometry bundle |
| 757 out->setKnownFourComponents(fGeoData[0].fColor); | 759 color->setKnownFourComponents(fGeoData[0].fColor); |
| 758 } | 760 coverage->setUnknownSingleComponent(); |
| 759 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { | 761 overrides->fUsePLSDstRead = false; |
| 760 out->setUnknownSingleComponent(); | |
| 761 } | 762 } |
| 762 | 763 |
| 763 private: | 764 private: |
| 764 void initBatchTracker(const GrPipelineOptimizations& opt) override { | 765 void initBatchTracker(const GrXPOverridesForBatch& overrides) override { |
| 765 // Handle any color overrides | 766 // Handle any color overrides |
| 766 if (!opt.readsColor()) { | 767 if (!overrides.readsColor()) { |
| 767 fGeoData[0].fColor = GrColor_ILLEGAL; | 768 fGeoData[0].fColor = GrColor_ILLEGAL; |
| 768 } | 769 } |
| 769 opt.getOverrideColorIfSet(&fGeoData[0].fColor); | 770 overrides.getOverrideColorIfSet(&fGeoData[0].fColor); |
| 770 | 771 |
| 771 // setup batch properties | 772 // setup batch properties |
| 772 fBatch.fColorIgnored = !opt.readsColor(); | 773 fBatch.fColorIgnored = !overrides.readsColor(); |
| 773 fBatch.fColor = fGeoData[0].fColor; | 774 fBatch.fColor = fGeoData[0].fColor; |
| 774 fBatch.fUsesLocalCoords = opt.readsLocalCoords(); | 775 fBatch.fUsesLocalCoords = overrides.readsLocalCoords(); |
| 775 fBatch.fCoverageIgnored = !opt.readsCoverage(); | 776 fBatch.fCoverageIgnored = !overrides.readsCoverage(); |
| 776 fBatch.fLinesOnly = SkPath::kLine_SegmentMask == fGeoData[0].fPath.getSe
gmentMasks(); | 777 fBatch.fLinesOnly = SkPath::kLine_SegmentMask == fGeoData[0].fPath.getSe
gmentMasks(); |
| 777 fBatch.fCanTweakAlphaForCoverage = opt.canTweakAlphaForCoverage(); | 778 fBatch.fCanTweakAlphaForCoverage = overrides.canTweakAlphaForCoverage(); |
| 778 } | 779 } |
| 779 | 780 |
| 780 void prepareLinesOnlyDraws(Target* target) { | 781 void prepareLinesOnlyDraws(Target* target) { |
| 781 bool canTweakAlphaForCoverage = this->canTweakAlphaForCoverage(); | 782 bool canTweakAlphaForCoverage = this->canTweakAlphaForCoverage(); |
| 782 | 783 |
| 783 // Setup GrGeometryProcessor | 784 // Setup GrGeometryProcessor |
| 784 SkAutoTUnref<const GrGeometryProcessor> gp(create_fill_gp(canTweakAlphaF
orCoverage, | 785 SkAutoTUnref<const GrGeometryProcessor> gp(create_fill_gp(canTweakAlphaF
orCoverage, |
| 785 this->viewMatr
ix(), | 786 this->viewMatr
ix(), |
| 786 this->usesLoca
lCoords(), | 787 this->usesLoca
lCoords(), |
| 787 this->coverage
Ignored())); | 788 this->coverage
Ignored())); |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1014 DRAW_BATCH_TEST_DEFINE(AAConvexPathBatch) { | 1015 DRAW_BATCH_TEST_DEFINE(AAConvexPathBatch) { |
| 1015 AAConvexPathBatch::Geometry geometry; | 1016 AAConvexPathBatch::Geometry geometry; |
| 1016 geometry.fColor = GrRandomColor(random); | 1017 geometry.fColor = GrRandomColor(random); |
| 1017 geometry.fViewMatrix = GrTest::TestMatrixInvertible(random); | 1018 geometry.fViewMatrix = GrTest::TestMatrixInvertible(random); |
| 1018 geometry.fPath = GrTest::TestPathConvex(random); | 1019 geometry.fPath = GrTest::TestPathConvex(random); |
| 1019 | 1020 |
| 1020 return AAConvexPathBatch::Create(geometry); | 1021 return AAConvexPathBatch::Create(geometry); |
| 1021 } | 1022 } |
| 1022 | 1023 |
| 1023 #endif | 1024 #endif |
| OLD | NEW |