| 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 "GrAALinearizingConvexPathRenderer.h" | 8 #include "GrAALinearizingConvexPathRenderer.h" |
| 9 | 9 |
| 10 #include "GrAAConvexTessellator.h" | 10 #include "GrAAConvexTessellator.h" |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 SkASSERT(!args.fShape->isEmpty()); | 326 SkASSERT(!args.fShape->isEmpty()); |
| 327 | 327 |
| 328 SkPath path; | 328 SkPath path; |
| 329 args.fShape->asPath(&path); | 329 args.fShape->asPath(&path); |
| 330 bool fill = args.fShape->style().isSimpleFill(); | 330 bool fill = args.fShape->style().isSimpleFill(); |
| 331 const SkStrokeRec& stroke = args.fShape->style().strokeRec(); | 331 const SkStrokeRec& stroke = args.fShape->style().strokeRec(); |
| 332 SkScalar strokeWidth = fill ? -1.0f : stroke.getWidth(); | 332 SkScalar strokeWidth = fill ? -1.0f : stroke.getWidth(); |
| 333 SkPaint::Join join = fill ? SkPaint::Join::kMiter_Join : stroke.getJoin(); | 333 SkPaint::Join join = fill ? SkPaint::Join::kMiter_Join : stroke.getJoin(); |
| 334 SkScalar miterLimit = stroke.getMiter(); | 334 SkScalar miterLimit = stroke.getMiter(); |
| 335 | 335 |
| 336 SkAutoTUnref<GrDrawBatch> batch(new AAFlatteningConvexPathBatch(args.fColor,
*args.fViewMatrix, | 336 SkAutoTUnref<GrDrawBatch> batch(new AAFlatteningConvexPathBatch(args.fPaint-
>getColor(), |
| 337 *args.fViewM
atrix, |
| 337 path, stroke
Width, join, | 338 path, stroke
Width, join, |
| 338 miterLimit))
; | 339 miterLimit))
; |
| 339 | 340 |
| 340 GrPipelineBuilder pipelineBuilder(*args.fPaint); | 341 GrPipelineBuilder pipelineBuilder(*args.fPaint); |
| 341 pipelineBuilder.setUserStencil(args.fUserStencilSettings); | 342 pipelineBuilder.setUserStencil(args.fUserStencilSettings); |
| 342 | 343 |
| 343 args.fDrawContext->drawBatch(pipelineBuilder, *args.fClip, batch); | 344 args.fDrawContext->drawBatch(pipelineBuilder, *args.fClip, batch); |
| 344 | 345 |
| 345 return true; | 346 return true; |
| 346 } | 347 } |
| 347 | 348 |
| 348 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 349 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
| 349 | 350 |
| 350 #ifdef GR_TEST_UTILS | 351 #ifdef GR_TEST_UTILS |
| 351 | 352 |
| 352 DRAW_BATCH_TEST_DEFINE(AAFlatteningConvexPathBatch) { | 353 DRAW_BATCH_TEST_DEFINE(AAFlatteningConvexPathBatch) { |
| 353 GrColor color = GrRandomColor(random); | 354 GrColor color = GrRandomColor(random); |
| 354 SkMatrix viewMatrix = GrTest::TestMatrixInvertible(random); | 355 SkMatrix viewMatrix = GrTest::TestMatrixInvertible(random); |
| 355 SkPath path = GrTest::TestPathConvex(random); | 356 SkPath path = GrTest::TestPathConvex(random); |
| 356 SkScalar strokeWidth = random->nextBool() ? -1.f : 2.f; | 357 SkScalar strokeWidth = random->nextBool() ? -1.f : 2.f; |
| 357 SkPaint::Join join = SkPaint::kMiter_Join; | 358 SkPaint::Join join = SkPaint::kMiter_Join; |
| 358 SkScalar miterLimit = 0.5f; | 359 SkScalar miterLimit = 0.5f; |
| 359 return new AAFlatteningConvexPathBatch(color, viewMatrix, path, strokeWidth,
join, miterLimit); | 360 return new AAFlatteningConvexPathBatch(color, viewMatrix, path, strokeWidth,
join, miterLimit); |
| 360 } | 361 } |
| 361 | 362 |
| 362 #endif | 363 #endif |
| OLD | NEW |