Chromium Code Reviews| Index: src/gpu/GrStencilAndCoverPathRenderer.cpp |
| diff --git a/src/gpu/GrStencilAndCoverPathRenderer.cpp b/src/gpu/GrStencilAndCoverPathRenderer.cpp |
| index aed1743af22216864a2aa2382a2ea724cc0c82a9..f7c8dd8bc458dd233d12890de2635f3197f522f8 100644 |
| --- a/src/gpu/GrStencilAndCoverPathRenderer.cpp |
| +++ b/src/gpu/GrStencilAndCoverPathRenderer.cpp |
| @@ -58,9 +58,20 @@ bool GrStencilAndCoverPathRenderer::canDrawPath(const GrDrawTarget* target, |
| const SkPath& path, |
| const SkStrokeRec& stroke, |
| bool antiAlias) const { |
| - return !stroke.isHairlineStyle() && |
| - !antiAlias && // doesn't do per-path AA, relies on the target having MSAA |
| - pipelineBuilder->getStencil().isDisabled(); |
| + |
| + if (stroke.isHairlineStyle()) { |
| + return false; |
| + } |
| + if (!pipelineBuilder->getStencil().isDisabled()) { |
| + return false; |
| + } |
| + if (antiAlias) { |
| + return pipelineBuilder->getRenderTarget()->isMultisampled( |
| + GrRenderTarget::kStencilBuffer_PipelineStage) && |
| + pipelineBuilder->canTweakAlphaForCoverage(); |
| + } else { |
| + return true; // doesn't do per-path AA, relies on the target having MSAA |
| + } |
| } |
| GrPathRenderer::StencilSupport |
| @@ -101,7 +112,6 @@ bool GrStencilAndCoverPathRenderer::onDrawPath(GrDrawTarget* target, |
| const SkPath& path, |
| const SkStrokeRec& stroke, |
| bool antiAlias) { |
| - SkASSERT(!antiAlias); |
| SkASSERT(!stroke.isHairlineStyle()); |
| SkASSERT(pipelineBuilder->getStencil().isDisabled()); |
| @@ -160,5 +170,10 @@ bool GrStencilAndCoverPathRenderer::onDrawPath(GrDrawTarget* target, |
| } |
| pipelineBuilder->stencil()->setDisabled(); |
| + if (antiAlias) { |
| + SkASSERT(pipelineBuilder->getRenderTarget()->isMultisampled( |
| + GrRenderTarget::kAnywhere_PipelineStage)); |
|
Chris Dalton
2015/03/20 07:01:45
Here we should also check GrRenderTarget::kStencil
|
| + pipelineBuilder->enableState(GrPipelineBuilder::kHWAntialias_StateBit); |
| + } |
| return true; |
| } |