OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "GrDefaultPathRenderer.h" | 8 #include "GrDefaultPathRenderer.h" |
9 | 9 |
10 #include "GrBatchFlushState.h" | 10 #include "GrBatchFlushState.h" |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 int firstVertex; | 314 int firstVertex; |
315 | 315 |
316 void* verts = target->makeVertexSpace(vertexStride, maxVertices, | 316 void* verts = target->makeVertexSpace(vertexStride, maxVertices, |
317 &vertexBuffer, &firstVertex); | 317 &vertexBuffer, &firstVertex); |
318 | 318 |
319 if (!verts) { | 319 if (!verts) { |
320 SkDebugf("Could not allocate vertices\n"); | 320 SkDebugf("Could not allocate vertices\n"); |
321 return; | 321 return; |
322 } | 322 } |
323 | 323 |
324 const GrIndexBuffer* indexBuffer = NULL; | 324 const GrIndexBuffer* indexBuffer = nullptr; |
325 int firstIndex = 0; | 325 int firstIndex = 0; |
326 | 326 |
327 void* indices = NULL; | 327 void* indices = nullptr; |
328 if (isIndexed) { | 328 if (isIndexed) { |
329 indices = target->makeIndexSpace(maxIndices, &indexBuffer, &firstInd
ex); | 329 indices = target->makeIndexSpace(maxIndices, &indexBuffer, &firstInd
ex); |
330 | 330 |
331 if (!indices) { | 331 if (!indices) { |
332 SkDebugf("Could not allocate indices\n"); | 332 SkDebugf("Could not allocate indices\n"); |
333 return; | 333 return; |
334 } | 334 } |
335 } | 335 } |
336 | 336 |
337 // fill buffers | 337 // fill buffers |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 const GrStencilSettings* passes[3]; | 562 const GrStencilSettings* passes[3]; |
563 GrPipelineBuilder::DrawFace drawFace[3]; | 563 GrPipelineBuilder::DrawFace drawFace[3]; |
564 bool reverse = false; | 564 bool reverse = false; |
565 bool lastPassIsBounds; | 565 bool lastPassIsBounds; |
566 | 566 |
567 if (isHairline) { | 567 if (isHairline) { |
568 passCount = 1; | 568 passCount = 1; |
569 if (stencilOnly) { | 569 if (stencilOnly) { |
570 passes[0] = &gDirectToStencil; | 570 passes[0] = &gDirectToStencil; |
571 } else { | 571 } else { |
572 passes[0] = NULL; | 572 passes[0] = nullptr; |
573 } | 573 } |
574 lastPassIsBounds = false; | 574 lastPassIsBounds = false; |
575 drawFace[0] = GrPipelineBuilder::kBoth_DrawFace; | 575 drawFace[0] = GrPipelineBuilder::kBoth_DrawFace; |
576 } else { | 576 } else { |
577 if (single_pass_path(path, *stroke)) { | 577 if (single_pass_path(path, *stroke)) { |
578 passCount = 1; | 578 passCount = 1; |
579 if (stencilOnly) { | 579 if (stencilOnly) { |
580 passes[0] = &gDirectToStencil; | 580 passes[0] = &gDirectToStencil; |
581 } else { | 581 } else { |
582 passes[0] = NULL; | 582 passes[0] = nullptr; |
583 } | 583 } |
584 drawFace[0] = GrPipelineBuilder::kBoth_DrawFace; | 584 drawFace[0] = GrPipelineBuilder::kBoth_DrawFace; |
585 lastPassIsBounds = false; | 585 lastPassIsBounds = false; |
586 } else { | 586 } else { |
587 switch (path.getFillType()) { | 587 switch (path.getFillType()) { |
588 case SkPath::kInverseEvenOdd_FillType: | 588 case SkPath::kInverseEvenOdd_FillType: |
589 reverse = true; | 589 reverse = true; |
590 // fallthrough | 590 // fallthrough |
591 case SkPath::kEvenOdd_FillType: | 591 case SkPath::kEvenOdd_FillType: |
592 passes[0] = &gEOStencilPass; | 592 passes[0] = &gEOStencilPass; |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
703 target->drawBatch(*pipelineBuilder, batch); | 703 target->drawBatch(*pipelineBuilder, batch); |
704 } | 704 } |
705 } | 705 } |
706 return true; | 706 return true; |
707 } | 707 } |
708 | 708 |
709 bool GrDefaultPathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const { | 709 bool GrDefaultPathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const { |
710 // this class can draw any path with any fill but doesn't do any anti-aliasi
ng. | 710 // this class can draw any path with any fill but doesn't do any anti-aliasi
ng. |
711 return !args.fAntiAlias && (args.fStroke->isFillStyle() || | 711 return !args.fAntiAlias && (args.fStroke->isFillStyle() || |
712 IsStrokeHairlineOrEquivalent(*args.fStroke, *arg
s.fViewMatrix, | 712 IsStrokeHairlineOrEquivalent(*args.fStroke, *arg
s.fViewMatrix, |
713 NULL)); | 713 nullptr)); |
714 } | 714 } |
715 | 715 |
716 bool GrDefaultPathRenderer::onDrawPath(const DrawPathArgs& args) { | 716 bool GrDefaultPathRenderer::onDrawPath(const DrawPathArgs& args) { |
717 return this->internalDrawPath(args.fTarget, | 717 return this->internalDrawPath(args.fTarget, |
718 args.fPipelineBuilder, | 718 args.fPipelineBuilder, |
719 args.fColor, | 719 args.fColor, |
720 *args.fViewMatrix, | 720 *args.fViewMatrix, |
721 *args.fPath, | 721 *args.fPath, |
722 *args.fStroke, | 722 *args.fStroke, |
723 false); | 723 false); |
(...skipping 28 matching lines...) Expand all Loading... |
752 geometry.fColor = color; | 752 geometry.fColor = color; |
753 geometry.fPath = path; | 753 geometry.fPath = path; |
754 geometry.fTolerance = srcSpaceTol; | 754 geometry.fTolerance = srcSpaceTol; |
755 | 755 |
756 viewMatrix.mapRect(&bounds); | 756 viewMatrix.mapRect(&bounds); |
757 uint8_t coverage = GrRandomCoverage(random); | 757 uint8_t coverage = GrRandomCoverage(random); |
758 return DefaultPathBatch::Create(geometry, coverage, viewMatrix, true, bounds
); | 758 return DefaultPathBatch::Create(geometry, coverage, viewMatrix, true, bounds
); |
759 } | 759 } |
760 | 760 |
761 #endif | 761 #endif |
OLD | NEW |