| Index: src/gpu/GrStencilAndCoverPathRenderer.cpp
|
| diff --git a/src/gpu/GrStencilAndCoverPathRenderer.cpp b/src/gpu/GrStencilAndCoverPathRenderer.cpp
|
| index 55487905324512eef122c9e59989e549cf30d97c..5f55c1a21412eaa43c523f96afbe52049013dbb3 100644
|
| --- a/src/gpu/GrStencilAndCoverPathRenderer.cpp
|
| +++ b/src/gpu/GrStencilAndCoverPathRenderer.cpp
|
| @@ -51,11 +51,22 @@ GrPathRenderer::StencilSupport GrStencilAndCoverPathRenderer::onGetStencilSuppor
|
| return GrPathRenderer::kStencilOnly_StencilSupport;
|
| }
|
|
|
| +static GrPath* get_gr_path(GrGpu* gpu, const SkPath& skPath, const SkStrokeRec& stroke) {
|
| + GrContext* ctx = gpu->getContext();
|
| + GrResourceKey resourceKey = GrPath::ComputeKey(skPath, stroke);
|
| + SkAutoTUnref<GrPath> path(static_cast<GrPath*>(ctx->findAndRefCachedResource(resourceKey)));
|
| + if (NULL == path || !path->isEqualTo(skPath, stroke)) {
|
| + path.reset(gpu->pathRendering()->createPath(skPath, stroke));
|
| + ctx->addResourceToCache(resourceKey, path);
|
| + }
|
| + return path.detach();
|
| +}
|
| +
|
| void GrStencilAndCoverPathRenderer::onStencilPath(const SkPath& path,
|
| const SkStrokeRec& stroke,
|
| GrDrawTarget* target) {
|
| SkASSERT(!path.isInverseFillType());
|
| - SkAutoTUnref<GrPath> p(fGpu->getContext()->createPath(path, stroke));
|
| + SkAutoTUnref<GrPath> p(get_gr_path(fGpu, path, stroke));
|
| target->stencilPath(p, path.getFillType());
|
| }
|
|
|
| @@ -69,7 +80,7 @@ bool GrStencilAndCoverPathRenderer::onDrawPath(const SkPath& path,
|
| GrDrawState* drawState = target->drawState();
|
| SkASSERT(drawState->getStencil().isDisabled());
|
|
|
| - SkAutoTUnref<GrPath> p(fGpu->getContext()->createPath(path, stroke));
|
| + SkAutoTUnref<GrPath> p(get_gr_path(fGpu, path, stroke));
|
|
|
| if (path.isInverseFillType()) {
|
| GR_STATIC_CONST_SAME_STENCIL(kInvertedStencilPass,
|
|
|