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