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

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

Issue 2127673002: Consolidate handling of infinitely thin primitives and aa bloat handing WRT batch bounds (Closed) Base URL: https://skia.googlesource.com/skia.git@AAStrokeRect
Patch Set: update for instanced rendering Created 4 years, 5 months 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/GrOvalRenderer.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 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "GrAAConvexPathRenderer.h" 8 #include "GrAAConvexPathRenderer.h"
9 9
10 #include "GrAAConvexTessellator.h" 10 #include "GrAAConvexTessellator.h"
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after
739 LocalCoords::kUnused_Type); 739 LocalCoords::kUnused_Type);
740 return MakeForDeviceSpace(color, coverage, localCoords, viewMatrix); 740 return MakeForDeviceSpace(color, coverage, localCoords, viewMatrix);
741 } 741 }
742 742
743 class AAConvexPathBatch : public GrVertexBatch { 743 class AAConvexPathBatch : public GrVertexBatch {
744 public: 744 public:
745 DEFINE_BATCH_CLASS_ID 745 DEFINE_BATCH_CLASS_ID
746 AAConvexPathBatch(GrColor color, const SkMatrix& viewMatrix, const SkPath& p ath) 746 AAConvexPathBatch(GrColor color, const SkMatrix& viewMatrix, const SkPath& p ath)
747 : INHERITED(ClassID()) { 747 : INHERITED(ClassID()) {
748 fGeoData.emplace_back(Geometry{color, viewMatrix, path}); 748 fGeoData.emplace_back(Geometry{color, viewMatrix, path});
749 // compute bounds 749 this->setTransformedBounds(path.getBounds(), viewMatrix, HasAABloat::kYe s,
750 fBounds = path.getBounds(); 750 IsZeroArea::kNo);
751 viewMatrix.mapRect(&fBounds);
752 } 751 }
753 752
754 const char* name() const override { return "AAConvexBatch"; } 753 const char* name() const override { return "AAConvexBatch"; }
755 754
756 void computePipelineOptimizations(GrInitInvariantOutput* color, 755 void computePipelineOptimizations(GrInitInvariantOutput* color,
757 GrInitInvariantOutput* coverage, 756 GrInitInvariantOutput* coverage,
758 GrBatchToXPOverrides* overrides) const ove rride { 757 GrBatchToXPOverrides* overrides) const ove rride {
759 // 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
760 color->setKnownFourComponents(fGeoData[0].fColor); 759 color->setKnownFourComponents(fGeoData[0].fColor);
761 coverage->setUnknownSingleComponent(); 760 coverage->setUnknownSingleComponent();
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
951 return false; 950 return false;
952 } 951 }
953 952
954 // In the event of two batches, one who can tweak, one who cannot, we ju st fall back to 953 // In the event of two batches, one who can tweak, one who cannot, we ju st fall back to
955 // not tweaking 954 // not tweaking
956 if (this->canTweakAlphaForCoverage() != that->canTweakAlphaForCoverage() ) { 955 if (this->canTweakAlphaForCoverage() != that->canTweakAlphaForCoverage() ) {
957 fBatch.fCanTweakAlphaForCoverage = false; 956 fBatch.fCanTweakAlphaForCoverage = false;
958 } 957 }
959 958
960 fGeoData.push_back_n(that->fGeoData.count(), that->fGeoData.begin()); 959 fGeoData.push_back_n(that->fGeoData.count(), that->fGeoData.begin());
961 this->joinBounds(that->bounds()); 960 this->joinBounds(*that);
962 return true; 961 return true;
963 } 962 }
964 963
965 GrColor color() const { return fBatch.fColor; } 964 GrColor color() const { return fBatch.fColor; }
966 bool linesOnly() const { return fBatch.fLinesOnly; } 965 bool linesOnly() const { return fBatch.fLinesOnly; }
967 bool usesLocalCoords() const { return fBatch.fUsesLocalCoords; } 966 bool usesLocalCoords() const { return fBatch.fUsesLocalCoords; }
968 bool canTweakAlphaForCoverage() const { return fBatch.fCanTweakAlphaForCover age; } 967 bool canTweakAlphaForCoverage() const { return fBatch.fCanTweakAlphaForCover age; }
969 const SkMatrix& viewMatrix() const { return fGeoData[0].fViewMatrix; } 968 const SkMatrix& viewMatrix() const { return fGeoData[0].fViewMatrix; }
970 bool coverageIgnored() const { return fBatch.fCoverageIgnored; } 969 bool coverageIgnored() const { return fBatch.fCoverageIgnored; }
971 970
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1017 1016
1018 DRAW_BATCH_TEST_DEFINE(AAConvexPathBatch) { 1017 DRAW_BATCH_TEST_DEFINE(AAConvexPathBatch) {
1019 GrColor color = GrRandomColor(random); 1018 GrColor color = GrRandomColor(random);
1020 SkMatrix viewMatrix = GrTest::TestMatrixInvertible(random); 1019 SkMatrix viewMatrix = GrTest::TestMatrixInvertible(random);
1021 SkPath path = GrTest::TestPathConvex(random); 1020 SkPath path = GrTest::TestPathConvex(random);
1022 1021
1023 return new AAConvexPathBatch(color, viewMatrix, path); 1022 return new AAConvexPathBatch(color, viewMatrix, path);
1024 } 1023 }
1025 1024
1026 #endif 1025 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrOvalRenderer.cpp ('k') | src/gpu/batches/GrAADistanceFieldPathRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698