Chromium Code Reviews| Index: src/gpu/GrStencilAndCoverPathRenderer.cpp | 
| diff --git a/src/gpu/GrStencilAndCoverPathRenderer.cpp b/src/gpu/GrStencilAndCoverPathRenderer.cpp | 
| index f7330a81f649246530ff3fa56162d83ecf3f854f..e745a2212c7ee3cb43ae1e1f26d0c68ce9c6ae26 100644 | 
| --- a/src/gpu/GrStencilAndCoverPathRenderer.cpp | 
| +++ b/src/gpu/GrStencilAndCoverPathRenderer.cpp | 
| @@ -17,7 +17,7 @@ | 
| GrPathRenderer* GrStencilAndCoverPathRenderer::Create(GrContext* context) { | 
| SkASSERT(NULL != context); | 
| SkASSERT(NULL != context->getGpu()); | 
| - if (context->getGpu()->caps()->pathStencilingSupport()) { | 
| + if (context->getGpu()->caps()->pathRenderingSupport()) { | 
| return SkNEW_ARGS(GrStencilAndCoverPathRenderer, (context->getGpu())); | 
| } else { | 
| return NULL; | 
| @@ -25,7 +25,7 @@ GrPathRenderer* GrStencilAndCoverPathRenderer::Create(GrContext* context) { | 
| } | 
| GrStencilAndCoverPathRenderer::GrStencilAndCoverPathRenderer(GrGpu* gpu) { | 
| - SkASSERT(gpu->caps()->pathStencilingSupport()); | 
| + SkASSERT(gpu->caps()->pathRenderingSupport()); | 
| fGpu = gpu; | 
| gpu->ref(); | 
| } | 
| @@ -40,6 +40,8 @@ bool GrStencilAndCoverPathRenderer::canDrawPath(const SkPath& path, | 
| bool antiAlias) const { | 
| return stroke.isFillStyle() && | 
| !antiAlias && // doesn't do per-path AA, relies on the target having MSAA | 
| + !target->getDrawState().willEffectReadDstColor() && // not supported yet | 
| 
 
Chris Dalton
2013/10/07 22:22:45
I'm trying to understand why reading the dst color
 
Kimmo Kinnunen
2013/10/08 12:14:09
True, should've mentioned in commit msg that it is
 
bsalomon
2013/10/08 14:05:08
Do you mean there are cases where requiring the ds
 
 | 
| + NULL != target->getDrawState().getRenderTarget()->getStencilBuffer() && | 
| target->getDrawState().getStencil().isDisabled(); | 
| } | 
| @@ -70,27 +72,7 @@ bool GrStencilAndCoverPathRenderer::onDrawPath(const SkPath& path, | 
| SkAutoTUnref<GrPath> p(fGpu->createPath(path)); | 
| - SkPath::FillType nonInvertedFill = SkPath::ConvertToNonInverseFillType(path.getFillType()); | 
| - target->stencilPath(p, stroke, nonInvertedFill); | 
| - | 
| - // TODO: Use built in cover operation rather than a rect draw. This will require making our | 
| - // fragment shaders be able to eat varyings generated by a matrix. | 
| - | 
| - // fill the path, zero out the stencil | 
| - SkRect bounds = p->getBounds(); | 
| - SkScalar bloat = drawState->getViewMatrix().getMaxStretch() * SK_ScalarHalf; | 
| - GrDrawState::AutoViewMatrixRestore avmr; | 
| - | 
| - if (nonInvertedFill == path.getFillType()) { | 
| - GR_STATIC_CONST_SAME_STENCIL(kStencilPass, | 
| - kZero_StencilOp, | 
| - kZero_StencilOp, | 
| - kNotEqual_StencilFunc, | 
| - 0xffff, | 
| - 0x0000, | 
| - 0xffff); | 
| - *drawState->stencil() = kStencilPass; | 
| - } else { | 
| + if (path.isInverseFillType()) { | 
| GR_STATIC_CONST_SAME_STENCIL(kInvertedStencilPass, | 
| kZero_StencilOp, | 
| kZero_StencilOp, | 
| @@ -101,23 +83,22 @@ bool GrStencilAndCoverPathRenderer::onDrawPath(const SkPath& path, | 
| 0xffff, | 
| 0x0000, | 
| 0xffff); | 
| - SkMatrix vmi; | 
| - bounds.setLTRB(0, 0, | 
| - SkIntToScalar(drawState->getRenderTarget()->width()), | 
| - SkIntToScalar(drawState->getRenderTarget()->height())); | 
| - // mapRect through persp matrix may not be correct | 
| - if (!drawState->getViewMatrix().hasPerspective() && drawState->getViewInverse(&vmi)) { | 
| - vmi.mapRect(&bounds); | 
| - // theoretically could set bloat = 0, instead leave it because of matrix inversion | 
| - // precision. | 
| - } else { | 
| - avmr.setIdentity(drawState); | 
| - bloat = 0; | 
| - } | 
| + | 
| *drawState->stencil() = kInvertedStencilPass; | 
| + } else { | 
| + GR_STATIC_CONST_SAME_STENCIL(kStencilPass, | 
| + kZero_StencilOp, | 
| + kZero_StencilOp, | 
| + kNotEqual_StencilFunc, | 
| + 0xffff, | 
| + 0x0000, | 
| + 0xffff); | 
| + | 
| + *drawState->stencil() = kStencilPass; | 
| } | 
| - bounds.outset(bloat, bloat); | 
| - target->drawSimpleRect(bounds, NULL); | 
| + | 
| + target->fillPath(p, stroke, path.getFillType()); | 
| + | 
| target->drawState()->stencil()->setDisabled(); | 
| return true; | 
| } |