OLD | NEW |
1 | |
2 /* | 1 /* |
3 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
4 * | 3 * |
5 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 5 * found in the LICENSE file. |
7 */ | 6 */ |
8 | 7 |
9 | 8 |
10 #include "GrStencilAndCoverPathRenderer.h" | 9 #include "GrStencilAndCoverPathRenderer.h" |
11 #include "GrCaps.h" | 10 #include "GrCaps.h" |
12 #include "GrContext.h" | 11 #include "GrContext.h" |
13 #include "GrDrawPathBatch.h" | 12 #include "GrDrawPathBatch.h" |
14 #include "GrGpu.h" | 13 #include "GrGpu.h" |
15 #include "GrPath.h" | 14 #include "GrPath.h" |
16 #include "GrRenderTarget.h" | 15 #include "GrRenderTarget.h" |
17 #include "GrResourceProvider.h" | 16 #include "GrResourceProvider.h" |
18 #include "GrStrokeInfo.h" | 17 #include "GrStrokeInfo.h" |
19 #include "batches/GrRectBatchFactory.h" | 18 #include "batches/GrRectBatchFactory.h" |
20 | 19 |
21 GrPathRenderer* GrStencilAndCoverPathRenderer::Create(GrResourceProvider* resour
ceProvider, | 20 GrPathRenderer* GrStencilAndCoverPathRenderer::Create(GrResourceProvider* resour
ceProvider, |
22 const GrCaps& caps) { | 21 const GrCaps& caps) { |
23 if (caps.shaderCaps()->pathRenderingSupport()) { | 22 if (caps.shaderCaps()->pathRenderingSupport()) { |
24 return new GrStencilAndCoverPathRenderer(resourceProvider); | 23 return new GrStencilAndCoverPathRenderer(resourceProvider); |
25 } else { | 24 } else { |
26 return nullptr; | 25 return nullptr; |
27 } | 26 } |
28 } | 27 } |
29 | 28 |
30 GrStencilAndCoverPathRenderer::GrStencilAndCoverPathRenderer(GrResourceProvider*
resourceProvider) | 29 GrStencilAndCoverPathRenderer::GrStencilAndCoverPathRenderer(GrResourceProvider*
resourceProvider) |
31 : fResourceProvider(resourceProvider) { | 30 : fResourceProvider(resourceProvider) { |
32 } | 31 } |
33 | 32 |
34 bool GrStencilAndCoverPathRenderer::onCanDrawPath(const CanDrawPathArgs& args) c
onst { | 33 bool GrStencilAndCoverPathRenderer::onCanDrawPath(const CanDrawPathArgs& args) c
onst { |
35 if (args.fStroke->isHairlineStyle()) { | 34 if (args.fStroke->isHairlineStyle()) { |
36 return false; | 35 return false; |
37 } | 36 } |
38 if (!args.fIsStencilDisabled) { | 37 if (!args.fIsStencilDisabled) { |
39 return false; | 38 return false; |
40 } | 39 } |
41 if (args.fAntiAlias) { | 40 if (args.fAntiAlias) { |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 | 141 |
143 pipelineBuilder->setStencil(kStencilPass); | 142 pipelineBuilder->setStencil(kStencilPass); |
144 SkAutoTUnref<GrDrawPathBatchBase> batch( | 143 SkAutoTUnref<GrDrawPathBatchBase> batch( |
145 GrDrawPathBatch::Create(viewMatrix, args.fColor, p->getFillType(
), p)); | 144 GrDrawPathBatch::Create(viewMatrix, args.fColor, p->getFillType(
), p)); |
146 args.fTarget->drawPathBatch(*pipelineBuilder, batch); | 145 args.fTarget->drawPathBatch(*pipelineBuilder, batch); |
147 } | 146 } |
148 | 147 |
149 pipelineBuilder->stencil()->setDisabled(); | 148 pipelineBuilder->stencil()->setDisabled(); |
150 return true; | 149 return true; |
151 } | 150 } |
OLD | NEW |