OLD | NEW |
---|---|
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2015 Google Inc. | 3 * Copyright 2015 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "GrAALinearizingConvexPathRenderer.h" | 9 #include "GrAALinearizingConvexPathRenderer.h" |
10 | 10 |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
257 sk_free(indices); | 257 sk_free(indices); |
258 } | 258 } |
259 | 259 |
260 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } | 260 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } |
261 | 261 |
262 AAFlatteningConvexPathBatch(const Geometry& geometry) : INHERITED(ClassID()) { | 262 AAFlatteningConvexPathBatch(const Geometry& geometry) : INHERITED(ClassID()) { |
263 fGeoData.push_back(geometry); | 263 fGeoData.push_back(geometry); |
264 | 264 |
265 // compute bounds | 265 // compute bounds |
266 fBounds = geometry.fPath.getBounds(); | 266 fBounds = geometry.fPath.getBounds(); |
267 SkScalar w = geometry.fStrokeWidth; | |
268 if (w > 0) { | |
269 w /= 2; | |
robertphillips
2015/11/23 18:58:46
// comment here about miter falling back to bevel
bsalomon
2015/11/23 19:01:19
Done.
| |
270 if (SkPaint::kMiter_Join == geometry.fJoin && w > 1.f) { | |
271 w *= geometry.fMiterLimit; | |
272 } | |
273 fBounds.outset(w, w); | |
274 } | |
267 geometry.fViewMatrix.mapRect(&fBounds); | 275 geometry.fViewMatrix.mapRect(&fBounds); |
268 } | 276 } |
269 | 277 |
270 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override { | 278 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override { |
271 AAFlatteningConvexPathBatch* that = t->cast<AAFlatteningConvexPathBatch> (); | 279 AAFlatteningConvexPathBatch* that = t->cast<AAFlatteningConvexPathBatch> (); |
272 if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *that->pi peline(), | 280 if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *that->pi peline(), |
273 that->bounds(), caps)) { | 281 that->bounds(), caps)) { |
274 return false; | 282 return false; |
275 } | 283 } |
276 | 284 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
338 DRAW_BATCH_TEST_DEFINE(AAFlatteningConvexPathBatch) { | 346 DRAW_BATCH_TEST_DEFINE(AAFlatteningConvexPathBatch) { |
339 AAFlatteningConvexPathBatch::Geometry geometry; | 347 AAFlatteningConvexPathBatch::Geometry geometry; |
340 geometry.fColor = GrRandomColor(random); | 348 geometry.fColor = GrRandomColor(random); |
341 geometry.fViewMatrix = GrTest::TestMatrixInvertible(random); | 349 geometry.fViewMatrix = GrTest::TestMatrixInvertible(random); |
342 geometry.fPath = GrTest::TestPathConvex(random); | 350 geometry.fPath = GrTest::TestPathConvex(random); |
343 | 351 |
344 return AAFlatteningConvexPathBatch::Create(geometry); | 352 return AAFlatteningConvexPathBatch::Create(geometry); |
345 } | 353 } |
346 | 354 |
347 #endif | 355 #endif |
OLD | NEW |