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

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

Issue 1344373005: Reland 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
« no previous file with comments | « src/gpu/batches/GrStrokeRectBatch.h ('k') | src/gpu/batches/GrTInstanceBatch.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "GrStrokeRectBatch.h" 8 #include "GrStrokeRectBatch.h"
9 #include "GrBatchTest.h" 9 #include "GrBatchTest.h"
10 #include "GrBatchFlushState.h" 10 #include "GrBatchFlushState.h"
11 #include "SkRandom.h" 11 #include "SkRandom.h"
12 12
13 GrStrokeRectBatch::GrStrokeRectBatch(const Geometry& geometry, bool snapToPixelC enters) { 13 GrStrokeRectBatch::GrStrokeRectBatch(const Geometry& geometry, bool snapToPixelC enters)
14 this->initClassID<GrStrokeRectBatch>(); 14 : INHERITED(ClassID()) {
15
16 fBatch.fHairline = geometry.fStrokeWidth == 0; 15 fBatch.fHairline = geometry.fStrokeWidth == 0;
17 16
18 fGeoData.push_back(geometry); 17 fGeoData.push_back(geometry);
19 18
20 // setup bounds 19 // setup bounds
21 fBounds = geometry.fRect; 20 fBounds = geometry.fRect;
22 SkScalar rad = SkScalarHalf(geometry.fStrokeWidth); 21 SkScalar rad = SkScalarHalf(geometry.fStrokeWidth);
23 fBounds.outset(rad, rad); 22 fBounds.outset(rad, rad);
24 geometry.fViewMatrix.mapRect(&fBounds); 23 geometry.fViewMatrix.mapRect(&fBounds);
25 24
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 GrStrokeRectBatch::Geometry geometry; 130 GrStrokeRectBatch::Geometry geometry;
132 geometry.fViewMatrix = GrTest::TestMatrix(random); 131 geometry.fViewMatrix = GrTest::TestMatrix(random);
133 geometry.fColor = GrRandomColor(random); 132 geometry.fColor = GrRandomColor(random);
134 geometry.fRect = GrTest::TestRect(random); 133 geometry.fRect = GrTest::TestRect(random);
135 geometry.fStrokeWidth = random->nextBool() ? 0.0f : 1.0f; 134 geometry.fStrokeWidth = random->nextBool() ? 0.0f : 1.0f;
136 135
137 return GrStrokeRectBatch::Create(geometry, random->nextBool()); 136 return GrStrokeRectBatch::Create(geometry, random->nextBool());
138 } 137 }
139 138
140 #endif 139 #endif
OLDNEW
« no previous file with comments | « src/gpu/batches/GrStrokeRectBatch.h ('k') | src/gpu/batches/GrTInstanceBatch.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698