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 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 bool fCanTweakAlphaForCoverage; | 313 bool fCanTweakAlphaForCoverage; |
314 }; | 314 }; |
315 | 315 |
316 BatchTracker fBatch; | 316 BatchTracker fBatch; |
317 SkSTArray<1, Geometry, true> fGeoData; | 317 SkSTArray<1, Geometry, true> fGeoData; |
318 | 318 |
319 typedef GrVertexBatch INHERITED; | 319 typedef GrVertexBatch INHERITED; |
320 }; | 320 }; |
321 | 321 |
322 bool GrAALinearizingConvexPathRenderer::onDrawPath(const DrawPathArgs& args) { | 322 bool GrAALinearizingConvexPathRenderer::onDrawPath(const DrawPathArgs& args) { |
323 GR_AUDIT_TRAIL_AUTO_FRAME(args.fTarget->getAuditTrail(), | 323 GR_AUDIT_TRAIL_AUTO_FRAME(args.fDrawContext->auditTrail(), |
324 "GrAALinearizingConvexPathRenderer::onDrawPath"); | 324 "GrAALinearizingConvexPathRenderer::onDrawPath"); |
325 if (args.fPath->isEmpty()) { | 325 if (args.fPath->isEmpty()) { |
326 return true; | 326 return true; |
327 } | 327 } |
328 AAFlatteningConvexPathBatch::Geometry geometry; | 328 AAFlatteningConvexPathBatch::Geometry geometry; |
329 geometry.fColor = args.fColor; | 329 geometry.fColor = args.fColor; |
330 geometry.fViewMatrix = *args.fViewMatrix; | 330 geometry.fViewMatrix = *args.fViewMatrix; |
331 geometry.fPath = *args.fPath; | 331 geometry.fPath = *args.fPath; |
332 bool fill = args.fStyle->isSimpleFill(); | 332 bool fill = args.fStyle->isSimpleFill(); |
333 geometry.fStrokeWidth = fill ? -1.0f : args.fStyle->strokeRec().getWidth(); | 333 geometry.fStrokeWidth = fill ? -1.0f : args.fStyle->strokeRec().getWidth(); |
334 geometry.fJoin = fill ? SkPaint::Join::kMiter_Join : args.fStyle->strokeRec(
).getJoin(); | 334 geometry.fJoin = fill ? SkPaint::Join::kMiter_Join : args.fStyle->strokeRec(
).getJoin(); |
335 geometry.fMiterLimit = args.fStyle->strokeRec().getMiter(); | 335 geometry.fMiterLimit = args.fStyle->strokeRec().getMiter(); |
336 | 336 |
337 SkAutoTUnref<GrDrawBatch> batch(AAFlatteningConvexPathBatch::Create(geometry
)); | 337 SkAutoTUnref<GrDrawBatch> batch(AAFlatteningConvexPathBatch::Create(geometry
)); |
338 args.fTarget->drawBatch(*args.fPipelineBuilder, *args.fClip, batch); | 338 |
| 339 GrPipelineBuilder pipelineBuilder(*args.fPaint, args.fDrawContext->isUnified
Multisampled()); |
| 340 pipelineBuilder.setRenderTarget(args.fDrawContext->accessRenderTarget()); |
| 341 pipelineBuilder.setUserStencil(args.fUserStencilSettings); |
| 342 |
| 343 args.fDrawContext->drawBatch(pipelineBuilder, *args.fClip, batch); |
339 | 344 |
340 return true; | 345 return true; |
341 } | 346 } |
342 | 347 |
343 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 348 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
344 | 349 |
345 #ifdef GR_TEST_UTILS | 350 #ifdef GR_TEST_UTILS |
346 | 351 |
347 DRAW_BATCH_TEST_DEFINE(AAFlatteningConvexPathBatch) { | 352 DRAW_BATCH_TEST_DEFINE(AAFlatteningConvexPathBatch) { |
348 AAFlatteningConvexPathBatch::Geometry geometry; | 353 AAFlatteningConvexPathBatch::Geometry geometry; |
349 geometry.fColor = GrRandomColor(random); | 354 geometry.fColor = GrRandomColor(random); |
350 geometry.fViewMatrix = GrTest::TestMatrixInvertible(random); | 355 geometry.fViewMatrix = GrTest::TestMatrixInvertible(random); |
351 geometry.fPath = GrTest::TestPathConvex(random); | 356 geometry.fPath = GrTest::TestPathConvex(random); |
352 | 357 |
353 return AAFlatteningConvexPathBatch::Create(geometry); | 358 return AAFlatteningConvexPathBatch::Create(geometry); |
354 } | 359 } |
355 | 360 |
356 #endif | 361 #endif |
OLD | NEW |