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" |
11 #include "GrContext.h" | 11 #include "GrContext.h" |
12 #include "GrDrawTargetCaps.h" | 12 #include "GrDrawTargetCaps.h" |
13 #include "GrGpu.h" | 13 #include "GrGpu.h" |
14 #include "GrPath.h" | 14 #include "GrPath.h" |
| 15 #include "GrRenderTarget.h" |
| 16 #include "GrRenderTargetPriv.h" |
15 #include "SkStrokeRec.h" | 17 #include "SkStrokeRec.h" |
16 | 18 |
17 /* | 19 /* |
18 * For now paths only natively support winding and even odd fill types | 20 * For now paths only natively support winding and even odd fill types |
19 */ | 21 */ |
20 static GrPathRendering::FillType convert_skpath_filltype(SkPath::FillType fill)
{ | 22 static GrPathRendering::FillType convert_skpath_filltype(SkPath::FillType fill)
{ |
21 switch (fill) { | 23 switch (fill) { |
22 default: | 24 default: |
23 SkFAIL("Incomplete Switch\n"); | 25 SkFAIL("Incomplete Switch\n"); |
24 case SkPath::kWinding_FillType: | 26 case SkPath::kWinding_FillType: |
(...skipping 26 matching lines...) Expand all Loading... |
51 } | 53 } |
52 | 54 |
53 bool GrStencilAndCoverPathRenderer::canDrawPath(const GrDrawTarget* target, | 55 bool GrStencilAndCoverPathRenderer::canDrawPath(const GrDrawTarget* target, |
54 const GrPipelineBuilder* pipelin
eBuilder, | 56 const GrPipelineBuilder* pipelin
eBuilder, |
55 const SkMatrix& viewMatrix, | 57 const SkMatrix& viewMatrix, |
56 const SkPath& path, | 58 const SkPath& path, |
57 const SkStrokeRec& stroke, | 59 const SkStrokeRec& stroke, |
58 bool antiAlias) const { | 60 bool antiAlias) const { |
59 return !stroke.isHairlineStyle() && | 61 return !stroke.isHairlineStyle() && |
60 !antiAlias && // doesn't do per-path AA, relies on the target having
MSAA | 62 !antiAlias && // doesn't do per-path AA, relies on the target having
MSAA |
61 pipelineBuilder->getRenderTarget()->getStencilBuffer() && | |
62 pipelineBuilder->getStencil().isDisabled(); | 63 pipelineBuilder->getStencil().isDisabled(); |
63 } | 64 } |
64 | 65 |
65 GrPathRenderer::StencilSupport | 66 GrPathRenderer::StencilSupport |
66 GrStencilAndCoverPathRenderer::onGetStencilSupport(const GrDrawTarget*, | 67 GrStencilAndCoverPathRenderer::onGetStencilSupport(const GrDrawTarget*, |
67 const GrPipelineBuilder*, | 68 const GrPipelineBuilder*, |
68 const SkPath&, | 69 const SkPath&, |
69 const SkStrokeRec&) const { | 70 const SkStrokeRec&) const { |
70 return GrPathRenderer::kStencilOnly_StencilSupport; | 71 return GrPathRenderer::kStencilOnly_StencilSupport; |
71 } | 72 } |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 0xffff); | 155 0xffff); |
155 | 156 |
156 pipelineBuilder->setStencil(kStencilPass); | 157 pipelineBuilder->setStencil(kStencilPass); |
157 SkAutoTUnref<GrPathProcessor> pp(GrPathProcessor::Create(color, viewMatr
ix)); | 158 SkAutoTUnref<GrPathProcessor> pp(GrPathProcessor::Create(color, viewMatr
ix)); |
158 target->drawPath(pipelineBuilder, pp, p, convert_skpath_filltype(path.ge
tFillType())); | 159 target->drawPath(pipelineBuilder, pp, p, convert_skpath_filltype(path.ge
tFillType())); |
159 } | 160 } |
160 | 161 |
161 pipelineBuilder->stencil()->setDisabled(); | 162 pipelineBuilder->stencil()->setDisabled(); |
162 return true; | 163 return true; |
163 } | 164 } |
OLD | NEW |