diff options
Diffstat (limited to 'src/gpu/batches/GrStencilAndCoverPathRenderer.cpp')
-rw-r--r-- | src/gpu/batches/GrStencilAndCoverPathRenderer.cpp | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/src/gpu/batches/GrStencilAndCoverPathRenderer.cpp b/src/gpu/batches/GrStencilAndCoverPathRenderer.cpp index ac9ed9035e..97287d2c86 100644 --- a/src/gpu/batches/GrStencilAndCoverPathRenderer.cpp +++ b/src/gpu/batches/GrStencilAndCoverPathRenderer.cpp @@ -44,8 +44,11 @@ bool GrStencilAndCoverPathRenderer::onCanDrawPath(const CanDrawPathArgs& args) c if (args.fHasUserStencilSettings) { return false; } - // doesn't do per-path AA, relies on the target having MSAA. - return (GrAAType::kCoverage != args.fAAType); + if (args.fAntiAlias) { + return args.fIsStencilBufferMSAA; + } else { + return true; // doesn't do per-path AA, relies on the target having MSAA + } } static GrPath* get_gr_path(GrResourceProvider* resourceProvider, const GrShape& shape) { @@ -77,14 +80,18 @@ static GrPath* get_gr_path(GrResourceProvider* resourceProvider, const GrShape& void GrStencilAndCoverPathRenderer::onStencilPath(const StencilPathArgs& args) { GR_AUDIT_TRAIL_AUTO_FRAME(args.fRenderTargetContext->auditTrail(), "GrStencilAndCoverPathRenderer::onStencilPath"); + SkASSERT(!args.fIsAA || args.fRenderTargetContext->isStencilBufferMultisampled()); + sk_sp<GrPath> p(get_gr_path(fResourceProvider, *args.fShape)); - args.fRenderTargetContext->priv().stencilPath(*args.fClip, args.fAAType, + args.fRenderTargetContext->priv().stencilPath(*args.fClip, args.fIsAA, *args.fViewMatrix, p.get()); } bool GrStencilAndCoverPathRenderer::onDrawPath(const DrawPathArgs& args) { GR_AUDIT_TRAIL_AUTO_FRAME(args.fRenderTargetContext->auditTrail(), "GrStencilAndCoverPathRenderer::onDrawPath"); + SkASSERT(!args.fPaint->isAntiAlias() || + args.fRenderTargetContext->isStencilBufferMultisampled()); SkASSERT(!args.fShape->style().strokeRec().isHairlineStyle()); const SkMatrix& viewMatrix = *args.fViewMatrix; @@ -118,8 +125,8 @@ bool GrStencilAndCoverPathRenderer::onDrawPath(const DrawPathArgs& args) { nullptr, &invert)); // fake inverse with a stencil and cover - args.fRenderTargetContext->priv().stencilPath(*args.fClip, args.fAAType, viewMatrix, - path.get()); + args.fRenderTargetContext->priv().stencilPath(*args.fClip, args.fPaint->isAntiAlias(), + viewMatrix, path.get()); { static constexpr GrUserStencilSettings kInvertedCoverPass( @@ -134,13 +141,10 @@ bool GrStencilAndCoverPathRenderer::onDrawPath(const DrawPathArgs& args) { GrUserStencilOp::kZero, 0xffff>() ); - // We have to suppress enabling MSAA for mixed samples or we will get seams due to - // coverage modulation along the edge where two triangles making up the rect meet. - GrAAType coverAAType = args.fAAType; - if (GrAAType::kMixedSamples == coverAAType) { - coverAAType = GrAAType::kNone; - } - GrPipelineBuilder pipelineBuilder(*args.fPaint, coverAAType); + + GrPipelineBuilder pipelineBuilder(*args.fPaint, + args.fPaint->isAntiAlias() && + !args.fRenderTargetContext->hasMixedSamples()); pipelineBuilder.setUserStencil(&kInvertedCoverPass); args.fRenderTargetContext->addDrawOp(pipelineBuilder, *args.fClip, coverBatch.get()); @@ -159,8 +163,13 @@ bool GrStencilAndCoverPathRenderer::onDrawPath(const DrawPathArgs& args) { sk_sp<GrDrawOp> batch(GrDrawPathBatch::Create(viewMatrix, args.fPaint->getColor(), path.get())); - GrPipelineBuilder pipelineBuilder(*args.fPaint, args.fAAType); + GrPipelineBuilder pipelineBuilder(*args.fPaint, args.fPaint->isAntiAlias()); pipelineBuilder.setUserStencil(&kCoverPass); + if (args.fAntiAlias) { + SkASSERT(args.fRenderTargetContext->isStencilBufferMultisampled()); + pipelineBuilder.enableState(GrPipelineBuilder::kHWAntialias_Flag); + } + args.fRenderTargetContext->addDrawOp(pipelineBuilder, *args.fClip, batch.get()); } |