Index: src/gpu/GrStencilAndCoverPathRenderer.cpp |
diff --git a/src/gpu/GrStencilAndCoverPathRenderer.cpp b/src/gpu/GrStencilAndCoverPathRenderer.cpp |
index f7330a81f649246530ff3fa56162d83ecf3f854f..ef3b953861639e47e35327cbd822017d583f94d8 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,7 @@ 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 |
+ NULL != target->getDrawState().getRenderTarget()->getStencilBuffer() && |
target->getDrawState().getStencil().isDisabled(); |
} |
@@ -70,27 +71,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 +82,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; |
} |