OLD | NEW |
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 : INHERITED(ClassID()) { | 14 this->initClassID<GrStrokeRectBatch>(); |
| 15 |
15 fBatch.fHairline = geometry.fStrokeWidth == 0; | 16 fBatch.fHairline = geometry.fStrokeWidth == 0; |
16 | 17 |
17 fGeoData.push_back(geometry); | 18 fGeoData.push_back(geometry); |
18 | 19 |
19 // setup bounds | 20 // setup bounds |
20 fBounds = geometry.fRect; | 21 fBounds = geometry.fRect; |
21 SkScalar rad = SkScalarHalf(geometry.fStrokeWidth); | 22 SkScalar rad = SkScalarHalf(geometry.fStrokeWidth); |
22 fBounds.outset(rad, rad); | 23 fBounds.outset(rad, rad); |
23 geometry.fViewMatrix.mapRect(&fBounds); | 24 geometry.fViewMatrix.mapRect(&fBounds); |
24 | 25 |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 GrStrokeRectBatch::Geometry geometry; | 131 GrStrokeRectBatch::Geometry geometry; |
131 geometry.fViewMatrix = GrTest::TestMatrix(random); | 132 geometry.fViewMatrix = GrTest::TestMatrix(random); |
132 geometry.fColor = GrRandomColor(random); | 133 geometry.fColor = GrRandomColor(random); |
133 geometry.fRect = GrTest::TestRect(random); | 134 geometry.fRect = GrTest::TestRect(random); |
134 geometry.fStrokeWidth = random->nextBool() ? 0.0f : 1.0f; | 135 geometry.fStrokeWidth = random->nextBool() ? 0.0f : 1.0f; |
135 | 136 |
136 return GrStrokeRectBatch::Create(geometry, random->nextBool()); | 137 return GrStrokeRectBatch::Create(geometry, random->nextBool()); |
137 } | 138 } |
138 | 139 |
139 #endif | 140 #endif |
OLD | NEW |