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

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

Issue 1483103003: Make onPrepareDraws const (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: merge 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
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 695 matching lines...) Expand 10 before | Expand all | Expand 10 after
706 // setup batch properties 706 // setup batch properties
707 fBatch.fColorIgnored = !overrides.readsColor(); 707 fBatch.fColorIgnored = !overrides.readsColor();
708 fBatch.fColor = fGeoData[0].fColor; 708 fBatch.fColor = fGeoData[0].fColor;
709 fBatch.fUsesLocalCoords = overrides.readsLocalCoords(); 709 fBatch.fUsesLocalCoords = overrides.readsLocalCoords();
710 fBatch.fCoverageIgnored = !overrides.readsCoverage(); 710 fBatch.fCoverageIgnored = !overrides.readsCoverage();
711 fBatch.fCoverage = fGeoData[0].fCoverage; 711 fBatch.fCoverage = fGeoData[0].fCoverage;
712 } 712 }
713 713
714 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } 714 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; }
715 715
716 void onPrepareDraws(Target*) override; 716 void onPrepareDraws(Target*) const override;
717 717
718 typedef SkTArray<SkPoint, true> PtArray; 718 typedef SkTArray<SkPoint, true> PtArray;
719 typedef SkTArray<int, true> IntArray; 719 typedef SkTArray<int, true> IntArray;
720 typedef SkTArray<float, true> FloatArray; 720 typedef SkTArray<float, true> FloatArray;
721 721
722 AAHairlineBatch(const Geometry& geometry) : INHERITED(ClassID()) { 722 AAHairlineBatch(const Geometry& geometry) : INHERITED(ClassID()) {
723 fGeoData.push_back(geometry); 723 fGeoData.push_back(geometry);
724 724
725 // compute bounds 725 // compute bounds
726 fBounds = geometry.fPath.getBounds(); 726 fBounds = geometry.fPath.getBounds();
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
784 bool fColorIgnored; 784 bool fColorIgnored;
785 bool fCoverageIgnored; 785 bool fCoverageIgnored;
786 }; 786 };
787 787
788 BatchTracker fBatch; 788 BatchTracker fBatch;
789 SkSTArray<1, Geometry, true> fGeoData; 789 SkSTArray<1, Geometry, true> fGeoData;
790 790
791 typedef GrVertexBatch INHERITED; 791 typedef GrVertexBatch INHERITED;
792 }; 792 };
793 793
794 void AAHairlineBatch::onPrepareDraws(Target* target) { 794 void AAHairlineBatch::onPrepareDraws(Target* target) const {
795 // Setup the viewmatrix and localmatrix for the GrGeometryProcessor. 795 // Setup the viewmatrix and localmatrix for the GrGeometryProcessor.
796 SkMatrix invert; 796 SkMatrix invert;
797 if (!this->viewMatrix().invert(&invert)) { 797 if (!this->viewMatrix().invert(&invert)) {
798 return; 798 return;
799 } 799 }
800 800
801 // we will transform to identity space if the viewmatrix does not have persp ective 801 // we will transform to identity space if the viewmatrix does not have persp ective
802 bool hasPerspective = this->viewMatrix().hasPerspective(); 802 bool hasPerspective = this->viewMatrix().hasPerspective();
803 const SkMatrix* geometryProcessorViewM = &SkMatrix::I(); 803 const SkMatrix* geometryProcessorViewM = &SkMatrix::I();
804 const SkMatrix* geometryProcessorLocalM = &invert; 804 const SkMatrix* geometryProcessorLocalM = &invert;
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
993 GrColor color = GrRandomColor(random); 993 GrColor color = GrRandomColor(random);
994 SkMatrix viewMatrix = GrTest::TestMatrix(random); 994 SkMatrix viewMatrix = GrTest::TestMatrix(random);
995 GrStrokeInfo stroke(SkStrokeRec::kHairline_InitStyle); 995 GrStrokeInfo stroke(SkStrokeRec::kHairline_InitStyle);
996 SkPath path = GrTest::TestPath(random); 996 SkPath path = GrTest::TestPath(random);
997 SkIRect devClipBounds; 997 SkIRect devClipBounds;
998 devClipBounds.setEmpty(); 998 devClipBounds.setEmpty();
999 return create_hairline_batch(color, viewMatrix, path, stroke, devClipBounds) ; 999 return create_hairline_batch(color, viewMatrix, path, stroke, devClipBounds) ;
1000 } 1000 }
1001 1001
1002 #endif 1002 #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