| 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" |
| 11 #include "GrBatchFlushState.h" | 11 #include "GrBatchFlushState.h" |
| 12 #include "GrBatchTest.h" | 12 #include "GrBatchTest.h" |
| 13 #include "GrContext.h" | 13 #include "GrContext.h" |
| 14 #include "GrDefaultGeoProcFactory.h" | 14 #include "GrDefaultGeoProcFactory.h" |
| 15 #include "GrGeometryProcessor.h" | 15 #include "GrGeometryProcessor.h" |
| 16 #include "GrInvariantOutput.h" | 16 #include "GrInvariantOutput.h" |
| 17 #include "GrPathUtils.h" | 17 #include "GrPathUtils.h" |
| 18 #include "GrProcessor.h" | 18 #include "GrProcessor.h" |
| 19 #include "GrPipelineBuilder.h" |
| 19 #include "GrStyle.h" | 20 #include "GrStyle.h" |
| 20 #include "SkGeometry.h" | 21 #include "SkGeometry.h" |
| 21 #include "SkString.h" | 22 #include "SkString.h" |
| 22 #include "SkTraceEvent.h" | 23 #include "SkTraceEvent.h" |
| 23 #include "SkPathPriv.h" | 24 #include "SkPathPriv.h" |
| 24 #include "batches/GrVertexBatch.h" | 25 #include "batches/GrVertexBatch.h" |
| 25 #include "glsl/GrGLSLGeometryProcessor.h" | 26 #include "glsl/GrGLSLGeometryProcessor.h" |
| 26 | 27 |
| 27 static const int DEFAULT_BUFFER_SIZE = 100; | 28 static const int DEFAULT_BUFFER_SIZE = 100; |
| 28 | 29 |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 const SkStrokeRec& stroke = args.fShape->style().strokeRec(); | 331 const SkStrokeRec& stroke = args.fShape->style().strokeRec(); |
| 331 SkScalar strokeWidth = fill ? -1.0f : stroke.getWidth(); | 332 SkScalar strokeWidth = fill ? -1.0f : stroke.getWidth(); |
| 332 SkPaint::Join join = fill ? SkPaint::Join::kMiter_Join : stroke.getJoin(); | 333 SkPaint::Join join = fill ? SkPaint::Join::kMiter_Join : stroke.getJoin(); |
| 333 SkScalar miterLimit = stroke.getMiter(); | 334 SkScalar miterLimit = stroke.getMiter(); |
| 334 | 335 |
| 335 SkAutoTUnref<GrDrawBatch> batch(new AAFlatteningConvexPathBatch(args.fPaint-
>getColor(), | 336 SkAutoTUnref<GrDrawBatch> batch(new AAFlatteningConvexPathBatch(args.fPaint-
>getColor(), |
| 336 *args.fViewM
atrix, | 337 *args.fViewM
atrix, |
| 337 path, stroke
Width, join, | 338 path, stroke
Width, join, |
| 338 miterLimit))
; | 339 miterLimit))
; |
| 339 | 340 |
| 340 args.fDrawContext->drawBatch(*args.fPaint, *args.fClip, *args.fUserStencilSe
ttings, batch); | 341 GrPipelineBuilder pipelineBuilder(*args.fPaint); |
| 342 pipelineBuilder.setUserStencil(args.fUserStencilSettings); |
| 343 |
| 344 args.fDrawContext->drawBatch(pipelineBuilder, *args.fClip, batch); |
| 345 |
| 341 return true; | 346 return true; |
| 342 } | 347 } |
| 343 | 348 |
| 344 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 349 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
| 345 | 350 |
| 346 #ifdef GR_TEST_UTILS | 351 #ifdef GR_TEST_UTILS |
| 347 | 352 |
| 348 DRAW_BATCH_TEST_DEFINE(AAFlatteningConvexPathBatch) { | 353 DRAW_BATCH_TEST_DEFINE(AAFlatteningConvexPathBatch) { |
| 349 GrColor color = GrRandomColor(random); | 354 GrColor color = GrRandomColor(random); |
| 350 SkMatrix viewMatrix = GrTest::TestMatrixInvertible(random); | 355 SkMatrix viewMatrix = GrTest::TestMatrixInvertible(random); |
| 351 SkPath path = GrTest::TestPathConvex(random); | 356 SkPath path = GrTest::TestPathConvex(random); |
| 352 SkScalar strokeWidth = random->nextBool() ? -1.f : 2.f; | 357 SkScalar strokeWidth = random->nextBool() ? -1.f : 2.f; |
| 353 SkPaint::Join join = SkPaint::kMiter_Join; | 358 SkPaint::Join join = SkPaint::kMiter_Join; |
| 354 SkScalar miterLimit = 0.5f; | 359 SkScalar miterLimit = 0.5f; |
| 355 return new AAFlatteningConvexPathBatch(color, viewMatrix, path, strokeWidth,
join, miterLimit); | 360 return new AAFlatteningConvexPathBatch(color, viewMatrix, path, strokeWidth,
join, miterLimit); |
| 356 } | 361 } |
| 357 | 362 |
| 358 #endif | 363 #endif |
| OLD | NEW |