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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 if (!args.fPipelineBuilder->getStencil().isDisabled()) { | 52 if (!args.fPipelineBuilder->getStencil().isDisabled()) { |
53 return false; | 53 return false; |
54 } | 54 } |
55 if (args.fAntiAlias) { | 55 if (args.fAntiAlias) { |
56 return args.fPipelineBuilder->getRenderTarget()->isStencilBufferMultisam
pled(); | 56 return args.fPipelineBuilder->getRenderTarget()->isStencilBufferMultisam
pled(); |
57 } else { | 57 } else { |
58 return true; // doesn't do per-path AA, relies on the target having MSAA | 58 return true; // doesn't do per-path AA, relies on the target having MSAA |
59 } | 59 } |
60 } | 60 } |
61 | 61 |
62 GrPathRenderer::StencilSupport | |
63 GrStencilAndCoverPathRenderer::onGetStencilSupport(const GrDrawTarget*, | |
64 const GrPipelineBuilder*, | |
65 const SkPath&, | |
66 const GrStrokeInfo&) const { | |
67 return GrPathRenderer::kStencilOnly_StencilSupport; | |
68 } | |
69 | |
70 static GrPath* get_gr_path(GrResourceProvider* resourceProvider, const SkPath& s
kPath, | 62 static GrPath* get_gr_path(GrResourceProvider* resourceProvider, const SkPath& s
kPath, |
71 const GrStrokeInfo& stroke) { | 63 const GrStrokeInfo& stroke) { |
72 GrUniqueKey key; | 64 GrUniqueKey key; |
73 bool isVolatile; | 65 bool isVolatile; |
74 GrPath::ComputeKey(skPath, stroke, &key, &isVolatile); | 66 GrPath::ComputeKey(skPath, stroke, &key, &isVolatile); |
75 SkAutoTUnref<GrPath> path( | 67 SkAutoTUnref<GrPath> path( |
76 static_cast<GrPath*>(resourceProvider->findAndRefResourceByUniqueKey(key
))); | 68 static_cast<GrPath*>(resourceProvider->findAndRefResourceByUniqueKey(key
))); |
77 if (!path) { | 69 if (!path) { |
78 path.reset(resourceProvider->createPath(skPath, stroke)); | 70 path.reset(resourceProvider->createPath(skPath, stroke)); |
79 if (!isVolatile) { | 71 if (!isVolatile) { |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 | 149 |
158 pipelineBuilder->setStencil(kStencilPass); | 150 pipelineBuilder->setStencil(kStencilPass); |
159 SkAutoTUnref<GrPathProcessor> pp(GrPathProcessor::Create(args.fColor, vi
ewMatrix)); | 151 SkAutoTUnref<GrPathProcessor> pp(GrPathProcessor::Create(args.fColor, vi
ewMatrix)); |
160 args.fTarget->drawPath(*pipelineBuilder, pp, p, | 152 args.fTarget->drawPath(*pipelineBuilder, pp, p, |
161 convert_skpath_filltype(path.getFillType())); | 153 convert_skpath_filltype(path.getFillType())); |
162 } | 154 } |
163 | 155 |
164 pipelineBuilder->stencil()->setDisabled(); | 156 pipelineBuilder->stencil()->setDisabled(); |
165 return true; | 157 return true; |
166 } | 158 } |
OLD | NEW |