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 fGpu->unref(); | 52 fGpu->unref(); |
53 } | 53 } |
54 | 54 |
55 bool GrStencilAndCoverPathRenderer::canDrawPath(const GrDrawTarget* target, | 55 bool GrStencilAndCoverPathRenderer::canDrawPath(const GrDrawTarget* target, |
56 const GrPipelineBuilder* pipelin eBuilder, | 56 const GrPipelineBuilder* pipelin eBuilder, |
57 const SkMatrix& viewMatrix, | 57 const SkMatrix& viewMatrix, |
58 const SkPath& path, | 58 const SkPath& path, |
59 const SkStrokeRec& stroke, | 59 const SkStrokeRec& stroke, |
60 bool antiAlias) const { | 60 bool antiAlias) const { |
61 return !stroke.isHairlineStyle() && | 61 return !stroke.isHairlineStyle() && |
62 !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 |
63 pipelineBuilder->getRenderTarget()->isMultisampled(kStencil_GrSampleC onfig)) && | |
63 pipelineBuilder->getStencil().isDisabled(); | 64 pipelineBuilder->getStencil().isDisabled(); |
Chris Dalton
2015/03/17 00:39:35
Here we can punt and only use nvfms if coverage mo
| |
64 } | 65 } |
65 | 66 |
66 GrPathRenderer::StencilSupport | 67 GrPathRenderer::StencilSupport |
67 GrStencilAndCoverPathRenderer::onGetStencilSupport(const GrDrawTarget*, | 68 GrStencilAndCoverPathRenderer::onGetStencilSupport(const GrDrawTarget*, |
68 const GrPipelineBuilder*, | 69 const GrPipelineBuilder*, |
69 const SkPath&, | 70 const SkPath&, |
70 const SkStrokeRec&) const { | 71 const SkStrokeRec&) const { |
71 return GrPathRenderer::kStencilOnly_StencilSupport; | 72 return GrPathRenderer::kStencilOnly_StencilSupport; |
72 } | 73 } |
73 | 74 |
(...skipping 20 matching lines...) Expand all Loading... | |
94 target->stencilPath(pipelineBuilder, pp, p, convert_skpath_filltype(path.get FillType())); | 95 target->stencilPath(pipelineBuilder, pp, p, convert_skpath_filltype(path.get FillType())); |
95 } | 96 } |
96 | 97 |
97 bool GrStencilAndCoverPathRenderer::onDrawPath(GrDrawTarget* target, | 98 bool GrStencilAndCoverPathRenderer::onDrawPath(GrDrawTarget* target, |
98 GrPipelineBuilder* pipelineBuilde r, | 99 GrPipelineBuilder* pipelineBuilde r, |
99 GrColor color, | 100 GrColor color, |
100 const SkMatrix& viewMatrix, | 101 const SkMatrix& viewMatrix, |
101 const SkPath& path, | 102 const SkPath& path, |
102 const SkStrokeRec& stroke, | 103 const SkStrokeRec& stroke, |
103 bool antiAlias) { | 104 bool antiAlias) { |
104 SkASSERT(!antiAlias); | 105 SkASSERT(!antiAlias || |
106 pipelineBuilder->getRenderTarget()->isMultisampled(kStencil_GrSampl eConfig)); | |
Chris Dalton
2015/03/16 19:31:24
We can take out this assert from here since we do
| |
105 SkASSERT(!stroke.isHairlineStyle()); | 107 SkASSERT(!stroke.isHairlineStyle()); |
106 | 108 |
107 SkASSERT(pipelineBuilder->getStencil().isDisabled()); | 109 SkASSERT(pipelineBuilder->getStencil().isDisabled()); |
108 | 110 |
109 SkAutoTUnref<GrPath> p(get_gr_path(fGpu, path, stroke)); | 111 SkAutoTUnref<GrPath> p(get_gr_path(fGpu, path, stroke)); |
110 | 112 |
111 if (path.isInverseFillType()) { | 113 if (path.isInverseFillType()) { |
112 GR_STATIC_CONST_SAME_STENCIL(kInvertedStencilPass, | 114 GR_STATIC_CONST_SAME_STENCIL(kInvertedStencilPass, |
113 kZero_StencilOp, | 115 kZero_StencilOp, |
114 kZero_StencilOp, | 116 kZero_StencilOp, |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
153 0xffff, | 155 0xffff, |
154 0x0000, | 156 0x0000, |
155 0xffff); | 157 0xffff); |
156 | 158 |
157 pipelineBuilder->setStencil(kStencilPass); | 159 pipelineBuilder->setStencil(kStencilPass); |
158 SkAutoTUnref<GrPathProcessor> pp(GrPathProcessor::Create(color, viewMatr ix)); | 160 SkAutoTUnref<GrPathProcessor> pp(GrPathProcessor::Create(color, viewMatr ix)); |
159 target->drawPath(pipelineBuilder, pp, p, convert_skpath_filltype(path.ge tFillType())); | 161 target->drawPath(pipelineBuilder, pp, p, convert_skpath_filltype(path.ge tFillType())); |
160 } | 162 } |
161 | 163 |
162 pipelineBuilder->stencil()->setDisabled(); | 164 pipelineBuilder->stencil()->setDisabled(); |
165 if (antiAlias) { | |
166 SkASSERT(pipelineBuilder->getRenderTarget()->isMultisampled(kStencil_GrS ampleConfig)); | |
167 pipelineBuilder->enableState(GrPipelineBuilder::kHWAntialias_StateBit); | |
168 } | |
163 return true; | 169 return true; |
164 } | 170 } |
OLD | NEW |