Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(293)

Side by Side Diff: src/gpu/batches/GrAAConvexPathRenderer.cpp

Issue 1467553002: New API for computing optimization invariants. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/GrProcOptInfo.cpp ('k') | src/gpu/batches/GrAADistanceFieldPathRenderer.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « src/gpu/GrProcOptInfo.cpp ('k') | src/gpu/batches/GrAADistanceFieldPathRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698