OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 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 "GrMSAAPathRenderer.h" | 8 #include "GrMSAAPathRenderer.h" |
9 | 9 |
10 #include "GrBatchFlushState.h" | 10 #include "GrBatchFlushState.h" |
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 GrColor color, | 571 GrColor color, |
572 const SkMatrix& viewMatrix, | 572 const SkMatrix& viewMatrix, |
573 const SkPath& path, | 573 const SkPath& path, |
574 bool stencilOnly) { | 574 bool stencilOnly) { |
575 | 575 |
576 const GrXPFactory* xpFactory = pipelineBuilder->getXPFactory(); | 576 const GrXPFactory* xpFactory = pipelineBuilder->getXPFactory(); |
577 SkAutoTUnref<const GrXPFactory> backupXPFactory(SkSafeRef(xpFactory)); | 577 SkAutoTUnref<const GrXPFactory> backupXPFactory(SkSafeRef(xpFactory)); |
578 // face culling doesn't make sense here | 578 // face culling doesn't make sense here |
579 SkASSERT(GrPipelineBuilder::kBoth_DrawFace == pipelineBuilder->getDrawFace()
); | 579 SkASSERT(GrPipelineBuilder::kBoth_DrawFace == pipelineBuilder->getDrawFace()
); |
580 | 580 |
581 int passCount = 0; | 581 int passCount = 0; |
582 const GrStencilSettings* passes[3]; | 582 const GrUserStencilSettings* passes[3]; |
583 GrPipelineBuilder::DrawFace drawFace[3]; | 583 GrPipelineBuilder::DrawFace drawFace[3]; |
584 bool reverse = false; | 584 bool reverse = false; |
585 bool lastPassIsBounds; | 585 bool lastPassIsBounds; |
586 | 586 |
587 if (single_pass_path(path)) { | 587 if (single_pass_path(path)) { |
588 passCount = 1; | 588 passCount = 1; |
589 if (stencilOnly) { | 589 if (stencilOnly) { |
590 passes[0] = &gDirectToStencil; | 590 passes[0] = &gDirectToStencil; |
591 } else { | 591 } else { |
592 passes[0] = nullptr; | 592 passes[0] = nullptr; |
593 } | 593 } |
594 drawFace[0] = GrPipelineBuilder::kBoth_DrawFace; | 594 drawFace[0] = GrPipelineBuilder::kBoth_DrawFace; |
595 lastPassIsBounds = false; | 595 lastPassIsBounds = false; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
640 return false; | 640 return false; |
641 } | 641 } |
642 } | 642 } |
643 | 643 |
644 SkRect devBounds; | 644 SkRect devBounds; |
645 GetPathDevBounds(path, pipelineBuilder->getRenderTarget(), viewMatrix, &devB
ounds); | 645 GetPathDevBounds(path, pipelineBuilder->getRenderTarget(), viewMatrix, &devB
ounds); |
646 | 646 |
647 for (int p = 0; p < passCount; ++p) { | 647 for (int p = 0; p < passCount; ++p) { |
648 pipelineBuilder->setDrawFace(drawFace[p]); | 648 pipelineBuilder->setDrawFace(drawFace[p]); |
649 if (passes[p]) { | 649 if (passes[p]) { |
650 *pipelineBuilder->stencil() = *passes[p]; | 650 pipelineBuilder->setUserStencil(passes[p]); |
651 } | 651 } |
652 | 652 |
653 if (lastPassIsBounds && (p == passCount-1)) { | 653 if (lastPassIsBounds && (p == passCount-1)) { |
654 // Reset the XP Factory on pipelineBuilder | 654 // Reset the XP Factory on pipelineBuilder |
655 pipelineBuilder->setXPFactory(backupXPFactory); | 655 pipelineBuilder->setXPFactory(backupXPFactory); |
656 SkRect bounds; | 656 SkRect bounds; |
657 SkMatrix localMatrix = SkMatrix::I(); | 657 SkMatrix localMatrix = SkMatrix::I(); |
658 if (reverse) { | 658 if (reverse) { |
659 SkASSERT(pipelineBuilder->getRenderTarget()); | 659 SkASSERT(pipelineBuilder->getRenderTarget()); |
660 // draw over the dev bounds (which will be the whole dst surface
for inv fill). | 660 // draw over the dev bounds (which will be the whole dst surface
for inv fill). |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
736 | 736 |
737 void GrMSAAPathRenderer::onStencilPath(const StencilPathArgs& args) { | 737 void GrMSAAPathRenderer::onStencilPath(const StencilPathArgs& args) { |
738 GR_AUDIT_TRAIL_AUTO_FRAME(args.fTarget->getAuditTrail(),"GrMSAAPathRenderer:
:onStencilPath"); | 738 GR_AUDIT_TRAIL_AUTO_FRAME(args.fTarget->getAuditTrail(),"GrMSAAPathRenderer:
:onStencilPath"); |
739 SkASSERT(SkPath::kInverseEvenOdd_FillType != args.fPath->getFillType()); | 739 SkASSERT(SkPath::kInverseEvenOdd_FillType != args.fPath->getFillType()); |
740 SkASSERT(SkPath::kInverseWinding_FillType != args.fPath->getFillType()); | 740 SkASSERT(SkPath::kInverseWinding_FillType != args.fPath->getFillType()); |
741 this->internalDrawPath(args.fTarget, args.fPipelineBuilder, GrColor_WHITE, *
args.fViewMatrix, | 741 this->internalDrawPath(args.fTarget, args.fPipelineBuilder, GrColor_WHITE, *
args.fViewMatrix, |
742 *args.fPath, true); | 742 *args.fPath, true); |
743 } | 743 } |
744 | 744 |
745 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 745 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
OLD | NEW |