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

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

Powered by Google App Engine
This is Rietveld 408576698