diff options
Diffstat (limited to 'src/gpu/batches/GrStencilAndCoverPathRenderer.cpp')
-rw-r--r-- | src/gpu/batches/GrStencilAndCoverPathRenderer.cpp | 53 |
1 files changed, 24 insertions, 29 deletions
diff --git a/src/gpu/batches/GrStencilAndCoverPathRenderer.cpp b/src/gpu/batches/GrStencilAndCoverPathRenderer.cpp index 1309dedd4c..ddba1c871e 100644 --- a/src/gpu/batches/GrStencilAndCoverPathRenderer.cpp +++ b/src/gpu/batches/GrStencilAndCoverPathRenderer.cpp @@ -36,7 +36,7 @@ bool GrStencilAndCoverPathRenderer::onCanDrawPath(const CanDrawPathArgs& args) c if (args.fStyle->hasNonDashPathEffect() || args.fStyle->strokeRec().isHairlineStyle()) { return false; } - if (args.fHasUserStencilSettings) { + if (!args.fIsStencilDisabled) { return false; } if (args.fAntiAlias) { @@ -80,7 +80,7 @@ bool GrStencilAndCoverPathRenderer::onDrawPath(const DrawPathArgs& args) { GrPipelineBuilder* pipelineBuilder = args.fPipelineBuilder; const SkMatrix& viewMatrix = *args.fViewMatrix; - SkASSERT(!pipelineBuilder->hasUserStencilSettings()); + SkASSERT(pipelineBuilder->getStencil().isDisabled()); if (args.fAntiAlias) { SkASSERT(pipelineBuilder->getRenderTarget()->isStencilBufferMultisampled()); @@ -90,21 +90,18 @@ bool GrStencilAndCoverPathRenderer::onDrawPath(const DrawPathArgs& args) { SkAutoTUnref<GrPath> p(get_gr_path(fResourceProvider, path, *args.fStyle)); if (path.isInverseFillType()) { - static constexpr GrUserStencilSettings kInvertedCoverPass( - GrUserStencilSettings::StaticInit< - 0x0000, - // We know our rect will hit pixels outside the clip and the user bits will be 0 - // outside the clip. So we can't just fill where the user bits are 0. We also need - // to check that the clip bit is set. - GrUserStencilTest::kEqualIfInClip, - 0xffff, - GrUserStencilOp::kKeep, - GrUserStencilOp::kZero, - 0xffff>() - ); - - - pipelineBuilder->setUserStencil(&kInvertedCoverPass); + static constexpr GrStencilSettings kInvertedStencilPass( + kKeep_StencilOp, + kZero_StencilOp, + // We know our rect will hit pixels outside the clip and the user bits will be 0 + // outside the clip. So we can't just fill where the user bits are 0. We also need to + // check that the clip bit is set. + kEqualIfInClip_StencilFunc, + 0xffff, + 0x0000, + 0xffff); + + pipelineBuilder->setStencil(kInvertedStencilPass); // fake inverse with a stencil and cover args.fTarget->stencilPath(*pipelineBuilder, viewMatrix, p, p->getFillType()); @@ -136,22 +133,20 @@ bool GrStencilAndCoverPathRenderer::onDrawPath(const DrawPathArgs& args) { &invert)); args.fTarget->drawBatch(*pipelineBuilder, batch); } else { - static constexpr GrUserStencilSettings kCoverPass( - GrUserStencilSettings::StaticInit< - 0x0000, - GrUserStencilTest::kNotEqual, - 0xffff, - GrUserStencilOp::kZero, - GrUserStencilOp::kKeep, - 0xffff>() - ); - - pipelineBuilder->setUserStencil(&kCoverPass); + static constexpr GrStencilSettings kStencilPass( + kZero_StencilOp, + kKeep_StencilOp, + kNotEqual_StencilFunc, + 0xffff, + 0x0000, + 0xffff); + + pipelineBuilder->setStencil(kStencilPass); SkAutoTUnref<GrDrawPathBatchBase> batch( GrDrawPathBatch::Create(viewMatrix, args.fColor, p->getFillType(), p)); args.fTarget->drawPathBatch(*pipelineBuilder, batch); } - pipelineBuilder->disableUserStencil(); + pipelineBuilder->stencil()->setDisabled(); return true; } |