Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(96)

Side by Side Diff: src/gpu/GrStencilAndCoverPathRenderer.cpp

Issue 858123002: Add specialized content key class for resources. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: remove default template arg Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/GrResourceCache2.cpp ('k') | src/gpu/GrStencilAndCoverTextContext.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 GrResourceKey resourceKey = GrPath::ComputeKey(skPath, stroke); 75 GrContentKey key;
76 SkAutoTUnref<GrPath> path(static_cast<GrPath*>(ctx->findAndRefCachedResource (resourceKey))); 76 GrPath::ComputeKey(skPath, stroke, &key);
77 SkAutoTUnref<GrPath> path(static_cast<GrPath*>(ctx->findAndRefCachedResource (key)));
77 if (NULL == path || !path->isEqualTo(skPath, stroke)) { 78 if (NULL == path || !path->isEqualTo(skPath, stroke)) {
78 path.reset(gpu->pathRendering()->createPath(skPath, stroke)); 79 path.reset(gpu->pathRendering()->createPath(skPath, stroke));
79 ctx->addResourceToCache(resourceKey, path); 80 ctx->addResourceToCache(key, path);
80 } 81 }
81 return path.detach(); 82 return path.detach();
82 } 83 }
83 84
84 void GrStencilAndCoverPathRenderer::onStencilPath(GrDrawTarget* target, 85 void GrStencilAndCoverPathRenderer::onStencilPath(GrDrawTarget* target,
85 GrPipelineBuilder* pipelineBui lder, 86 GrPipelineBuilder* pipelineBui lder,
86 const SkMatrix& viewMatrix, 87 const SkMatrix& viewMatrix,
87 const SkPath& path, 88 const SkPath& path,
88 const SkStrokeRec& stroke) { 89 const SkStrokeRec& stroke) {
89 SkASSERT(!path.isInverseFillType()); 90 SkASSERT(!path.isInverseFillType());
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 0xffff); 154 0xffff);
154 155
155 pipelineBuilder->setStencil(kStencilPass); 156 pipelineBuilder->setStencil(kStencilPass);
156 SkAutoTUnref<GrPathProcessor> pp(GrPathProcessor::Create(color, viewMatr ix)); 157 SkAutoTUnref<GrPathProcessor> pp(GrPathProcessor::Create(color, viewMatr ix));
157 target->drawPath(pipelineBuilder, pp, p, convert_skpath_filltype(path.ge tFillType())); 158 target->drawPath(pipelineBuilder, pp, p, convert_skpath_filltype(path.ge tFillType()));
158 } 159 }
159 160
160 pipelineBuilder->stencil()->setDisabled(); 161 pipelineBuilder->stencil()->setDisabled();
161 return true; 162 return true;
162 } 163 }
OLDNEW
« no previous file with comments | « src/gpu/GrResourceCache2.cpp ('k') | src/gpu/GrStencilAndCoverTextContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698