| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 | 9 |
| 10 #include "GrStencilAndCoverPathRenderer.h" | 10 #include "GrStencilAndCoverPathRenderer.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 GrPathRenderer::StencilSupport | 65 GrPathRenderer::StencilSupport |
| 66 GrStencilAndCoverPathRenderer::onGetStencilSupport(const GrDrawTarget*, | 66 GrStencilAndCoverPathRenderer::onGetStencilSupport(const GrDrawTarget*, |
| 67 const GrPipelineBuilder*, | 67 const GrPipelineBuilder*, |
| 68 const SkPath&, | 68 const SkPath&, |
| 69 const SkStrokeRec&) const { | 69 const SkStrokeRec&) const { |
| 70 return GrPathRenderer::kStencilOnly_StencilSupport; | 70 return GrPathRenderer::kStencilOnly_StencilSupport; |
| 71 } | 71 } |
| 72 | 72 |
| 73 static GrPath* get_gr_path(GrGpu* gpu, const SkPath& skPath, const SkStrokeRec&
stroke) { | 73 static GrPath* get_gr_path(GrGpu* gpu, const SkPath& skPath, const SkStrokeRec&
stroke) { |
| 74 GrContext* ctx = gpu->getContext(); | 74 GrContext* ctx = gpu->getContext(); |
| 75 GrContentKey key; | 75 GrUniqueKey key; |
| 76 GrPath::ComputeKey(skPath, stroke, &key); | 76 GrPath::ComputeKey(skPath, stroke, &key); |
| 77 SkAutoTUnref<GrPath> path(static_cast<GrPath*>(ctx->findAndRefCachedResource
(key))); | 77 SkAutoTUnref<GrPath> path(static_cast<GrPath*>(ctx->findAndRefCachedResource
(key))); |
| 78 if (NULL == path || !path->isEqualTo(skPath, stroke)) { | 78 if (NULL == path || !path->isEqualTo(skPath, stroke)) { |
| 79 path.reset(gpu->pathRendering()->createPath(skPath, stroke)); | 79 path.reset(gpu->pathRendering()->createPath(skPath, stroke)); |
| 80 ctx->addResourceToCache(key, path); | 80 ctx->addResourceToCache(key, path); |
| 81 } | 81 } |
| 82 return path.detach(); | 82 return path.detach(); |
| 83 } | 83 } |
| 84 | 84 |
| 85 void GrStencilAndCoverPathRenderer::onStencilPath(GrDrawTarget* target, | 85 void GrStencilAndCoverPathRenderer::onStencilPath(GrDrawTarget* target, |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 0xffff); | 154 0xffff); |
| 155 | 155 |
| 156 pipelineBuilder->setStencil(kStencilPass); | 156 pipelineBuilder->setStencil(kStencilPass); |
| 157 SkAutoTUnref<GrPathProcessor> pp(GrPathProcessor::Create(color, viewMatr
ix)); | 157 SkAutoTUnref<GrPathProcessor> pp(GrPathProcessor::Create(color, viewMatr
ix)); |
| 158 target->drawPath(pipelineBuilder, pp, p, convert_skpath_filltype(path.ge
tFillType())); | 158 target->drawPath(pipelineBuilder, pp, p, convert_skpath_filltype(path.ge
tFillType())); |
| 159 } | 159 } |
| 160 | 160 |
| 161 pipelineBuilder->stencil()->setDisabled(); | 161 pipelineBuilder->stencil()->setDisabled(); |
| 162 return true; | 162 return true; |
| 163 } | 163 } |
| OLD | NEW |