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

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

Issue 1345393003: Revert of add a ClassID function to GrBatch (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 3 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 654 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 } 665 }
666 if (!first) { 666 if (!first) {
667 return tolDevBounds.contains(actualBounds); 667 return tolDevBounds.contains(actualBounds);
668 } 668 }
669 669
670 return true; 670 return true;
671 } 671 }
672 672
673 class AAHairlineBatch : public GrVertexBatch { 673 class AAHairlineBatch : public GrVertexBatch {
674 public: 674 public:
675 DEFINE_BATCH_CLASS_ID
676
677 struct Geometry { 675 struct Geometry {
678 GrColor fColor; 676 GrColor fColor;
679 uint8_t fCoverage; 677 uint8_t fCoverage;
680 SkMatrix fViewMatrix; 678 SkMatrix fViewMatrix;
681 SkPath fPath; 679 SkPath fPath;
682 SkIRect fDevClipBounds; 680 SkIRect fDevClipBounds;
683 }; 681 };
684 682
685 static GrDrawBatch* Create(const Geometry& geometry) { return new AAHairline Batch(geometry); } 683 static GrDrawBatch* Create(const Geometry& geometry) { return new AAHairline Batch(geometry); }
686 684
(...skipping 24 matching lines...) Expand all
711 } 709 }
712 710
713 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } 711 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; }
714 712
715 void onPrepareDraws(Target*) override; 713 void onPrepareDraws(Target*) override;
716 714
717 typedef SkTArray<SkPoint, true> PtArray; 715 typedef SkTArray<SkPoint, true> PtArray;
718 typedef SkTArray<int, true> IntArray; 716 typedef SkTArray<int, true> IntArray;
719 typedef SkTArray<float, true> FloatArray; 717 typedef SkTArray<float, true> FloatArray;
720 718
721 AAHairlineBatch(const Geometry& geometry) : INHERITED(ClassID()) { 719 AAHairlineBatch(const Geometry& geometry) {
720 this->initClassID<AAHairlineBatch>();
722 fGeoData.push_back(geometry); 721 fGeoData.push_back(geometry);
723 722
724 // compute bounds 723 // compute bounds
725 fBounds = geometry.fPath.getBounds(); 724 fBounds = geometry.fPath.getBounds();
726 geometry.fViewMatrix.mapRect(&fBounds); 725 geometry.fViewMatrix.mapRect(&fBounds);
727 726
728 // This is b.c. hairlines are notionally infinitely thin so without expa nsion 727 // This is b.c. hairlines are notionally infinitely thin so without expa nsion
729 // two overlapping lines could be reordered even though they hit the sam e pixels. 728 // two overlapping lines could be reordered even though they hit the sam e pixels.
730 fBounds.outset(0.5f, 0.5f); 729 fBounds.outset(0.5f, 0.5f);
731 } 730 }
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
779 GrColor fColor; 778 GrColor fColor;
780 uint8_t fCoverage; 779 uint8_t fCoverage;
781 SkRect fDevBounds; 780 SkRect fDevBounds;
782 bool fUsesLocalCoords; 781 bool fUsesLocalCoords;
783 bool fColorIgnored; 782 bool fColorIgnored;
784 bool fCoverageIgnored; 783 bool fCoverageIgnored;
785 }; 784 };
786 785
787 BatchTracker fBatch; 786 BatchTracker fBatch;
788 SkSTArray<1, Geometry, true> fGeoData; 787 SkSTArray<1, Geometry, true> fGeoData;
789
790 typedef GrVertexBatch INHERITED;
791 }; 788 };
792 789
793 void AAHairlineBatch::onPrepareDraws(Target* target) { 790 void AAHairlineBatch::onPrepareDraws(Target* target) {
794 // Setup the viewmatrix and localmatrix for the GrGeometryProcessor. 791 // Setup the viewmatrix and localmatrix for the GrGeometryProcessor.
795 SkMatrix invert; 792 SkMatrix invert;
796 if (!this->viewMatrix().invert(&invert)) { 793 if (!this->viewMatrix().invert(&invert)) {
797 return; 794 return;
798 } 795 }
799 796
800 // we will transform to identity space if the viewmatrix does not have persp ective 797 // we will transform to identity space if the viewmatrix does not have persp ective
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
992 GrColor color = GrRandomColor(random); 989 GrColor color = GrRandomColor(random);
993 SkMatrix viewMatrix = GrTest::TestMatrix(random); 990 SkMatrix viewMatrix = GrTest::TestMatrix(random);
994 GrStrokeInfo stroke(SkStrokeRec::kHairline_InitStyle); 991 GrStrokeInfo stroke(SkStrokeRec::kHairline_InitStyle);
995 SkPath path = GrTest::TestPath(random); 992 SkPath path = GrTest::TestPath(random);
996 SkIRect devClipBounds; 993 SkIRect devClipBounds;
997 devClipBounds.setEmpty(); 994 devClipBounds.setEmpty();
998 return create_hairline_batch(color, viewMatrix, path, stroke, devClipBounds) ; 995 return create_hairline_batch(color, viewMatrix, path, stroke, devClipBounds) ;
999 } 996 }
1000 997
1001 #endif 998 #endif
OLDNEW
« no previous file with comments | « src/gpu/batches/GrAADistanceFieldPathRenderer.cpp ('k') | src/gpu/batches/GrAALinearizingConvexPathRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698