Index: src/gpu/GrStencilAndCoverPathRenderer.cpp |
diff --git a/src/gpu/GrStencilAndCoverPathRenderer.cpp b/src/gpu/GrStencilAndCoverPathRenderer.cpp |
index f7330a81f649246530ff3fa56162d83ecf3f854f..c59082c1ee6a651c1c29d686432419418647dad7 100644 |
--- a/src/gpu/GrStencilAndCoverPathRenderer.cpp |
+++ b/src/gpu/GrStencilAndCoverPathRenderer.cpp |
@@ -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 |
+ !target->getDrawState().willEffectReadDstColor() && // not supported yet |
Chris Dalton
2013/09/13 19:49:58
I don't think we need this constraint anymore. Wit
bsalomon
2013/09/13 20:25:28
Really? I think onDrawPath will have to handle thi
Kimmo Kinnunen
2013/09/18 07:52:38
I don't think there's code for this yet.. Left as
|
target->getDrawState().getStencil().isDisabled(); |
} |
@@ -70,27 +71,24 @@ 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()) { |
+ if (!path.isInverseFillType()) { |
GR_STATIC_CONST_SAME_STENCIL(kStencilPass, |
- kZero_StencilOp, |
- kZero_StencilOp, |
- kNotEqual_StencilFunc, |
- 0xffff, |
- 0x0000, |
- 0xffff); |
+ kZero_StencilOp, |
+ kZero_StencilOp, |
+ kNotEqual_StencilFunc, |
+ 0xffff, |
+ 0x0000, |
+ 0xffff); |
+ |
*drawState->stencil() = kStencilPass; |
+ |
+ target->drawPath(p, stroke, path.getFillType()); |
} else { |
+ SkPath::FillType nonInvertedFill = SkPath::ConvertToNonInverseFillType(path.getFillType()); |
+ target->stencilPath(p, stroke, nonInvertedFill); |
+ |
+ GrDrawState::AutoViewMatrixRestore avmr; |
+ |
GR_STATIC_CONST_SAME_STENCIL(kInvertedStencilPass, |
kZero_StencilOp, |
kZero_StencilOp, |
@@ -101,23 +99,25 @@ bool GrStencilAndCoverPathRenderer::onDrawPath(const SkPath& path, |
0xffff, |
0x0000, |
0xffff); |
+ |
+ |
SkMatrix vmi; |
- bounds.setLTRB(0, 0, |
- SkIntToScalar(drawState->getRenderTarget()->width()), |
- SkIntToScalar(drawState->getRenderTarget()->height())); |
+ SkRect bounds = SkRect::MakeLTRB(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. |
+ SkScalar bloat = drawState->getViewMatrix().getMaxStretch() * SK_ScalarHalf; |
+ bounds.outset(bloat, bloat); |
} else { |
avmr.setIdentity(drawState); |
- bloat = 0; |
} |
*drawState->stencil() = kInvertedStencilPass; |
+ target->drawSimpleRect(bounds, NULL); |
} |
- bounds.outset(bloat, bloat); |
- target->drawSimpleRect(bounds, NULL); |
target->drawState()->stencil()->setDisabled(); |
return true; |
} |