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

Side by Side Diff: src/gpu/batches/GrAAStrokeRectBatch.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 2015 Google Inc. 2 * Copyright 2015 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 "GrAAStrokeRectBatch.h" 8 #include "GrAAStrokeRectBatch.h"
9 9
10 #include "GrBatchFlushState.h" 10 #include "GrBatchFlushState.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 void init() { this->updateBounds(&fBounds, fGeoData[0]); } 100 void init() { this->updateBounds(&fBounds, fGeoData[0]); }
101 101
102 private: 102 private:
103 void updateBounds(SkRect* bounds, const Geometry& geo) { 103 void updateBounds(SkRect* bounds, const Geometry& geo) {
104 // If we have miterstroke then we inset devOutside and outset devOutside Assist, so we need 104 // If we have miterstroke then we inset devOutside and outset devOutside Assist, so we need
105 // the join for proper bounds 105 // the join for proper bounds
106 *bounds = geo.fDevOutside; 106 *bounds = geo.fDevOutside;
107 bounds->join(geo.fDevOutsideAssist); 107 bounds->join(geo.fDevOutsideAssist);
108 } 108 }
109 109
110 void onPrepareDraws(Target*) override; 110 void onPrepareDraws(Target*) const override;
111 void initBatchTracker(const GrXPOverridesForBatch&) override; 111 void initBatchTracker(const GrXPOverridesForBatch&) override;
112 112
113 AAStrokeRectBatch(const SkMatrix& viewMatrix,bool miterStroke) 113 AAStrokeRectBatch(const SkMatrix& viewMatrix,bool miterStroke)
114 : INHERITED(ClassID()) { 114 : INHERITED(ClassID()) {
115 fViewMatrix = viewMatrix; 115 fViewMatrix = viewMatrix;
116 fMiterStroke = miterStroke; 116 fMiterStroke = miterStroke;
117 } 117 }
118 118
119 static const int kMiterIndexCnt = 3 * 24; 119 static const int kMiterIndexCnt = 3 * 24;
120 static const int kMiterVertexCnt = 16; 120 static const int kMiterVertexCnt = 16;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 overrides.getOverrideColorIfSet(&fGeoData[0].fColor); 175 overrides.getOverrideColorIfSet(&fGeoData[0].fColor);
176 176
177 // setup batch properties 177 // setup batch properties
178 fBatch.fColorIgnored = !overrides.readsColor(); 178 fBatch.fColorIgnored = !overrides.readsColor();
179 fBatch.fColor = fGeoData[0].fColor; 179 fBatch.fColor = fGeoData[0].fColor;
180 fBatch.fUsesLocalCoords = overrides.readsLocalCoords(); 180 fBatch.fUsesLocalCoords = overrides.readsLocalCoords();
181 fBatch.fCoverageIgnored = !overrides.readsCoverage(); 181 fBatch.fCoverageIgnored = !overrides.readsCoverage();
182 fBatch.fCanTweakAlphaForCoverage = overrides.canTweakAlphaForCoverage(); 182 fBatch.fCanTweakAlphaForCoverage = overrides.canTweakAlphaForCoverage();
183 } 183 }
184 184
185 void AAStrokeRectBatch::onPrepareDraws(Target* target) { 185 void AAStrokeRectBatch::onPrepareDraws(Target* target) const {
186 bool canTweakAlphaForCoverage = this->canTweakAlphaForCoverage(); 186 bool canTweakAlphaForCoverage = this->canTweakAlphaForCoverage();
187 187
188 SkAutoTUnref<const GrGeometryProcessor> gp(create_stroke_rect_gp(canTweakAlp haForCoverage, 188 SkAutoTUnref<const GrGeometryProcessor> gp(create_stroke_rect_gp(canTweakAlp haForCoverage,
189 this->viewM atrix(), 189 this->viewM atrix(),
190 this->usesL ocalCoords(), 190 this->usesL ocalCoords(),
191 this->cover ageIgnored())); 191 this->cover ageIgnored()));
192 if (!gp) { 192 if (!gp) {
193 SkDebugf("Couldn't create GrGeometryProcessor\n"); 193 SkDebugf("Couldn't create GrGeometryProcessor\n");
194 return; 194 return;
195 } 195 }
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
656 SkRect inside = outside; 656 SkRect inside = outside;
657 inside.inset(strokeWidth, strokeWidth); 657 inside.inset(strokeWidth, strokeWidth);
658 658
659 GrColor color = GrRandomColor(random); 659 GrColor color = GrRandomColor(random);
660 660
661 return GrAAStrokeRectBatch::Create(color, GrTest::TestMatrix(random), outsid e, outsideAssist, 661 return GrAAStrokeRectBatch::Create(color, GrTest::TestMatrix(random), outsid e, outsideAssist,
662 inside, miterStroke, inside.isFinite() && inside.isEmpty()); 662 inside, miterStroke, inside.isFinite() && inside.isEmpty());
663 } 663 }
664 664
665 #endif 665 #endif
OLDNEW
« no previous file with comments | « src/gpu/batches/GrAALinearizingConvexPathRenderer.cpp ('k') | src/gpu/batches/GrAtlasTextBatch.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698