| 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 "GrAAStrokeRectBatch.h" | 8 #include "GrAAStrokeRectBatch.h" |
| 9 | 9 |
| 10 #include "GrBatchFlushState.h" | 10 #include "GrBatchFlushState.h" |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 : INHERITED(ClassID()) | 125 : INHERITED(ClassID()) |
| 126 , fViewMatrix(viewMatrix) { | 126 , fViewMatrix(viewMatrix) { |
| 127 SkASSERT(!devOutside.isEmpty()) | 127 SkASSERT(!devOutside.isEmpty()) |
| 128 SkASSERT(!devInside.isEmpty()) | 128 SkASSERT(!devInside.isEmpty()) |
| 129 | 129 |
| 130 fGeoData.emplace_back(Geometry{color, devOutside, devOutside, devInside,
false}); | 130 fGeoData.emplace_back(Geometry{color, devOutside, devOutside, devInside,
false}); |
| 131 fBounds = devOutside; | 131 fBounds = devOutside; |
| 132 fMiterStroke = true; | 132 fMiterStroke = true; |
| 133 } | 133 } |
| 134 | 134 |
| 135 | |
| 136 static GrDrawBatch* Create(GrColor color, const SkMatrix& viewMatrix, const
SkRect& rect, | 135 static GrDrawBatch* Create(GrColor color, const SkMatrix& viewMatrix, const
SkRect& rect, |
| 137 const SkStrokeRec& stroke) { | 136 const SkStrokeRec& stroke) { |
| 138 bool isMiter; | 137 bool isMiter; |
| 139 if (!allowed_stroke(stroke, &isMiter)) { | 138 if (!allowed_stroke(stroke, &isMiter)) { |
| 140 return nullptr; | 139 return nullptr; |
| 141 } | 140 } |
| 142 | 141 |
| 143 AAStrokeRectBatch* batch = new AAStrokeRectBatch(); | 142 AAStrokeRectBatch* batch = new AAStrokeRectBatch(); |
| 144 batch->fMiterStroke = isMiter; | 143 batch->fMiterStroke = isMiter; |
| 145 Geometry& geo = batch->fGeoData.push_back(); | 144 Geometry& geo = batch->fGeoData.push_back(); |
| (...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 SkStrokeRec rec(SkStrokeRec::kFill_InitStyle); | 614 SkStrokeRec rec(SkStrokeRec::kFill_InitStyle); |
| 616 rec.setStrokeStyle(strokeWidth); | 615 rec.setStrokeStyle(strokeWidth); |
| 617 rec.setStrokeParams(SkPaint::kButt_Cap, | 616 rec.setStrokeParams(SkPaint::kButt_Cap, |
| 618 miterStroke ? SkPaint::kMiter_Join : SkPaint::kBevel_Joi
n, | 617 miterStroke ? SkPaint::kMiter_Join : SkPaint::kBevel_Joi
n, |
| 619 1.f); | 618 1.f); |
| 620 SkMatrix matrix = GrTest::TestMatrixRectStaysRect(random); | 619 SkMatrix matrix = GrTest::TestMatrixRectStaysRect(random); |
| 621 return GrAAStrokeRectBatch::Create(color, matrix, rect, rec); | 620 return GrAAStrokeRectBatch::Create(color, matrix, rect, rec); |
| 622 } | 621 } |
| 623 | 622 |
| 624 #endif | 623 #endif |
| OLD | NEW |