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 "GrCaps.h" | 11 #include "GrCaps.h" |
12 #include "GrContext.h" | 12 #include "GrContext.h" |
13 #include "GrDrawPathBatch.h" | 13 #include "GrDrawPathBatch.h" |
14 #include "GrGpu.h" | 14 #include "GrGpu.h" |
15 #include "GrPath.h" | 15 #include "GrPath.h" |
16 #include "GrRenderTarget.h" | 16 #include "GrRenderTarget.h" |
17 #include "GrResourceProvider.h" | 17 #include "GrResourceProvider.h" |
18 #include "GrStrokeInfo.h" | 18 #include "GrStrokeInfo.h" |
| 19 #include "batches/GrRectBatchFactory.h" |
19 | 20 |
20 GrPathRenderer* GrStencilAndCoverPathRenderer::Create(GrResourceProvider* resour
ceProvider, | 21 GrPathRenderer* GrStencilAndCoverPathRenderer::Create(GrResourceProvider* resour
ceProvider, |
21 const GrCaps& caps) { | 22 const GrCaps& caps) { |
22 if (caps.shaderCaps()->pathRenderingSupport()) { | 23 if (caps.shaderCaps()->pathRenderingSupport()) { |
23 return new GrStencilAndCoverPathRenderer(resourceProvider); | 24 return new GrStencilAndCoverPathRenderer(resourceProvider); |
24 } else { | 25 } else { |
25 return nullptr; | 26 return nullptr; |
26 } | 27 } |
27 } | 28 } |
28 | 29 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 bounds.outset(bloat, bloat); | 115 bounds.outset(bloat, bloat); |
115 } else { | 116 } else { |
116 if (!viewMatrix.invert(&invert)) { | 117 if (!viewMatrix.invert(&invert)) { |
117 return false; | 118 return false; |
118 } | 119 } |
119 } | 120 } |
120 const SkMatrix& viewM = viewMatrix.hasPerspective() ? SkMatrix::I() : vi
ewMatrix; | 121 const SkMatrix& viewM = viewMatrix.hasPerspective() ? SkMatrix::I() : vi
ewMatrix; |
121 if (pipelineBuilder->getRenderTarget()->hasMixedSamples()) { | 122 if (pipelineBuilder->getRenderTarget()->hasMixedSamples()) { |
122 pipelineBuilder->disableState(GrPipelineBuilder::kHWAntialias_Flag); | 123 pipelineBuilder->disableState(GrPipelineBuilder::kHWAntialias_Flag); |
123 } | 124 } |
124 args.fTarget->drawNonAARect(*pipelineBuilder, args.fColor, viewM, bounds
, invert); | 125 |
| 126 SkAutoTUnref<GrDrawBatch> batch( |
| 127 GrRectBatchFactory::CreateNonAAFill(args.fColor, viewM, bounds,
nullptr, |
| 128 &invert)); |
| 129 args.fTarget->drawBatch(*pipelineBuilder, batch); |
125 } else { | 130 } else { |
126 GR_STATIC_CONST_SAME_STENCIL(kStencilPass, | 131 GR_STATIC_CONST_SAME_STENCIL(kStencilPass, |
127 kZero_StencilOp, | 132 kZero_StencilOp, |
128 kKeep_StencilOp, | 133 kKeep_StencilOp, |
129 kNotEqual_StencilFunc, | 134 kNotEqual_StencilFunc, |
130 0xffff, | 135 0xffff, |
131 0x0000, | 136 0x0000, |
132 0xffff); | 137 0xffff); |
133 | 138 |
134 pipelineBuilder->setStencil(kStencilPass); | 139 pipelineBuilder->setStencil(kStencilPass); |
135 SkAutoTUnref<GrDrawPathBatchBase> batch( | 140 SkAutoTUnref<GrDrawPathBatchBase> batch( |
136 GrDrawPathBatch::Create(viewMatrix, args.fColor, p->getFillType(
), p)); | 141 GrDrawPathBatch::Create(viewMatrix, args.fColor, p->getFillType(
), p)); |
137 args.fTarget->drawPathBatch(*pipelineBuilder, batch); | 142 args.fTarget->drawPathBatch(*pipelineBuilder, batch); |
138 } | 143 } |
139 | 144 |
140 pipelineBuilder->stencil()->setDisabled(); | 145 pipelineBuilder->stencil()->setDisabled(); |
141 return true; | 146 return true; |
142 } | 147 } |
OLD | NEW |