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

Side by Side Diff: src/gpu/batches/GrAAHairLinePathRenderer.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
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 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 "GrAAHairLinePathRenderer.h" 8 #include "GrAAHairLinePathRenderer.h"
9 9
10 #include "GrBatchFlushState.h" 10 #include "GrBatchFlushState.h"
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 public: 676 public:
677 DEFINE_BATCH_CLASS_ID 677 DEFINE_BATCH_CLASS_ID
678 678
679 AAHairlineBatch(GrColor color, 679 AAHairlineBatch(GrColor color,
680 uint8_t coverage, 680 uint8_t coverage,
681 const SkMatrix& viewMatrix, 681 const SkMatrix& viewMatrix,
682 const SkPath& path, 682 const SkPath& path,
683 SkIRect devClipBounds) : INHERITED(ClassID()) { 683 SkIRect devClipBounds) : INHERITED(ClassID()) {
684 fGeoData.emplace_back(Geometry{color, coverage, viewMatrix, path, devCli pBounds}); 684 fGeoData.emplace_back(Geometry{color, coverage, viewMatrix, path, devCli pBounds});
685 685
686 // compute bounds 686 this->setTransformedBounds(path.getBounds(), viewMatrix, HasAABloat::kYe s,
687 fBounds = path.getBounds(); 687 IsZeroArea::kYes);
688 viewMatrix.mapRect(&fBounds);
689
690 // This is b.c. hairlines are notionally infinitely thin so without expa nsion
691 // two overlapping lines could be reordered even though they hit the sam e pixels.
692 fBounds.outset(0.5f, 0.5f);
693 } 688 }
694 689
695 const char* name() const override { return "AAHairlineBatch"; } 690 const char* name() const override { return "AAHairlineBatch"; }
696 691
697 void computePipelineOptimizations(GrInitInvariantOutput* color, 692 void computePipelineOptimizations(GrInitInvariantOutput* color,
698 GrInitInvariantOutput* coverage, 693 GrInitInvariantOutput* coverage,
699 GrBatchToXPOverrides* overrides) const ove rride { 694 GrBatchToXPOverrides* overrides) const ove rride {
700 // When this is called on a batch, there is only one geometry bundle 695 // When this is called on a batch, there is only one geometry bundle
701 color->setKnownFourComponents(fGeoData[0].fColor); 696 color->setKnownFourComponents(fGeoData[0].fColor);
702 coverage->setUnknownSingleComponent(); 697 coverage->setUnknownSingleComponent();
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
752 if (this->color() != that->color()) { 747 if (this->color() != that->color()) {
753 return false; 748 return false;
754 } 749 }
755 750
756 SkASSERT(this->usesLocalCoords() == that->usesLocalCoords()); 751 SkASSERT(this->usesLocalCoords() == that->usesLocalCoords());
757 if (this->usesLocalCoords() && !this->viewMatrix().cheapEqualTo(that->vi ewMatrix())) { 752 if (this->usesLocalCoords() && !this->viewMatrix().cheapEqualTo(that->vi ewMatrix())) {
758 return false; 753 return false;
759 } 754 }
760 755
761 fGeoData.push_back_n(that->fGeoData.count(), that->fGeoData.begin()); 756 fGeoData.push_back_n(that->fGeoData.count(), that->fGeoData.begin());
762 this->joinBounds(that->bounds()); 757 this->joinBounds(*that);
763 return true; 758 return true;
764 } 759 }
765 760
766 GrColor color() const { return fBatch.fColor; } 761 GrColor color() const { return fBatch.fColor; }
767 uint8_t coverage() const { return fBatch.fCoverage; } 762 uint8_t coverage() const { return fBatch.fCoverage; }
768 bool usesLocalCoords() const { return fBatch.fUsesLocalCoords; } 763 bool usesLocalCoords() const { return fBatch.fUsesLocalCoords; }
769 const SkMatrix& viewMatrix() const { return fGeoData[0].fViewMatrix; } 764 const SkMatrix& viewMatrix() const { return fGeoData[0].fViewMatrix; }
770 bool coverageIgnored() const { return fBatch.fCoverageIgnored; } 765 bool coverageIgnored() const { return fBatch.fCoverageIgnored; }
771 766
772 767
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
986 DRAW_BATCH_TEST_DEFINE(AAHairlineBatch) { 981 DRAW_BATCH_TEST_DEFINE(AAHairlineBatch) {
987 GrColor color = GrRandomColor(random); 982 GrColor color = GrRandomColor(random);
988 SkMatrix viewMatrix = GrTest::TestMatrix(random); 983 SkMatrix viewMatrix = GrTest::TestMatrix(random);
989 SkPath path = GrTest::TestPath(random); 984 SkPath path = GrTest::TestPath(random);
990 SkIRect devClipBounds; 985 SkIRect devClipBounds;
991 devClipBounds.setEmpty(); 986 devClipBounds.setEmpty();
992 return create_hairline_batch(color, viewMatrix, path, GrStyle::SimpleHairlin e(), devClipBounds); 987 return create_hairline_batch(color, viewMatrix, path, GrStyle::SimpleHairlin e(), devClipBounds);
993 } 988 }
994 989
995 #endif 990 #endif
OLDNEW
« no previous file with comments | « src/gpu/batches/GrAAFillRectBatch.cpp ('k') | src/gpu/batches/GrAALinearizingConvexPathRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698