| 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 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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.fDrawContext->auditTrail(), | 323 GR_AUDIT_TRAIL_AUTO_FRAME(args.fDrawContext->auditTrail(), |
| 324 "GrAALinearizingConvexPathRenderer::onDrawPath"); | 324 "GrAALinearizingConvexPathRenderer::onDrawPath"); |
| 325 SkASSERT(!args.fDrawContext->isUnifiedMultisampled()); |
| 326 |
| 325 if (args.fPath->isEmpty()) { | 327 if (args.fPath->isEmpty()) { |
| 326 return true; | 328 return true; |
| 327 } | 329 } |
| 328 AAFlatteningConvexPathBatch::Geometry geometry; | 330 AAFlatteningConvexPathBatch::Geometry geometry; |
| 329 geometry.fColor = args.fColor; | 331 geometry.fColor = args.fColor; |
| 330 geometry.fViewMatrix = *args.fViewMatrix; | 332 geometry.fViewMatrix = *args.fViewMatrix; |
| 331 geometry.fPath = *args.fPath; | 333 geometry.fPath = *args.fPath; |
| 332 bool fill = args.fStyle->isSimpleFill(); | 334 bool fill = args.fStyle->isSimpleFill(); |
| 333 geometry.fStrokeWidth = fill ? -1.0f : args.fStyle->strokeRec().getWidth(); | 335 geometry.fStrokeWidth = fill ? -1.0f : args.fStyle->strokeRec().getWidth(); |
| 334 geometry.fJoin = fill ? SkPaint::Join::kMiter_Join : args.fStyle->strokeRec(
).getJoin(); | 336 geometry.fJoin = fill ? SkPaint::Join::kMiter_Join : args.fStyle->strokeRec(
).getJoin(); |
| 335 geometry.fMiterLimit = args.fStyle->strokeRec().getMiter(); | 337 geometry.fMiterLimit = args.fStyle->strokeRec().getMiter(); |
| 336 | 338 |
| 337 SkAutoTUnref<GrDrawBatch> batch(AAFlatteningConvexPathBatch::Create(geometry
)); | 339 SkAutoTUnref<GrDrawBatch> batch(AAFlatteningConvexPathBatch::Create(geometry
)); |
| 338 | 340 |
| 339 GrPipelineBuilder pipelineBuilder(*args.fPaint, args.fDrawContext->isUnified
Multisampled()); | 341 GrPipelineBuilder pipelineBuilder(*args.fPaint); |
| 340 pipelineBuilder.setUserStencil(args.fUserStencilSettings); | 342 pipelineBuilder.setUserStencil(args.fUserStencilSettings); |
| 341 | 343 |
| 342 args.fDrawContext->drawBatch(pipelineBuilder, *args.fClip, batch); | 344 args.fDrawContext->drawBatch(pipelineBuilder, *args.fClip, batch); |
| 343 | 345 |
| 344 return true; | 346 return true; |
| 345 } | 347 } |
| 346 | 348 |
| 347 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 349 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
| 348 | 350 |
| 349 #ifdef GR_TEST_UTILS | 351 #ifdef GR_TEST_UTILS |
| 350 | 352 |
| 351 DRAW_BATCH_TEST_DEFINE(AAFlatteningConvexPathBatch) { | 353 DRAW_BATCH_TEST_DEFINE(AAFlatteningConvexPathBatch) { |
| 352 AAFlatteningConvexPathBatch::Geometry geometry; | 354 AAFlatteningConvexPathBatch::Geometry geometry; |
| 353 geometry.fColor = GrRandomColor(random); | 355 geometry.fColor = GrRandomColor(random); |
| 354 geometry.fViewMatrix = GrTest::TestMatrixInvertible(random); | 356 geometry.fViewMatrix = GrTest::TestMatrixInvertible(random); |
| 355 geometry.fPath = GrTest::TestPathConvex(random); | 357 geometry.fPath = GrTest::TestPathConvex(random); |
| 356 | 358 |
| 357 return AAFlatteningConvexPathBatch::Create(geometry); | 359 return AAFlatteningConvexPathBatch::Create(geometry); |
| 358 } | 360 } |
| 359 | 361 |
| 360 #endif | 362 #endif |
| OLD | NEW |