| 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 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 Loading... |
| 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 |
| OLD | NEW |