OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
3 * | 3 * |
4 * 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 |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 | 8 |
9 #include "GrPathRendererChain.h" | 9 #include "GrPathRendererChain.h" |
10 | 10 |
11 #include "GrCaps.h" | 11 #include "GrCaps.h" |
12 #include "gl/GrGLCaps.h" | 12 #include "gl/GrGLCaps.h" |
13 #include "glsl/GrGLSLCaps.h" | 13 #include "glsl/GrGLSLCaps.h" |
14 #include "GrContext.h" | 14 #include "GrContext.h" |
15 #include "GrGpu.h" | 15 #include "GrGpu.h" |
16 | 16 |
17 #include "batches/GrAAConvexPathRenderer.h" | 17 #include "batches/GrAAConvexPathRenderer.h" |
18 #include "batches/GrAADistanceFieldPathRenderer.h" | 18 #include "batches/GrAADistanceFieldPathRenderer.h" |
19 #include "batches/GrAAHairLinePathRenderer.h" | 19 #include "batches/GrAAHairLinePathRenderer.h" |
20 #include "batches/GrAALinearizingConvexPathRenderer.h" | 20 #include "batches/GrAALinearizingConvexPathRenderer.h" |
21 #include "batches/GrDashLinePathRenderer.h" | 21 #include "batches/GrDashLinePathRenderer.h" |
22 #include "batches/GrDefaultPathRenderer.h" | 22 #include "batches/GrDefaultPathRenderer.h" |
23 #include "batches/GrMSAAPathRenderer.h" | 23 #include "batches/GrMSAAPathRenderer.h" |
24 #include "batches/GrPLSPathRenderer.h" | 24 #include "batches/GrPLSPathRenderer.h" |
25 #include "batches/GrStencilAndCoverPathRenderer.h" | 25 #include "batches/GrStencilAndCoverPathRenderer.h" |
26 #include "batches/GrTessellatingPathRenderer.h" | 26 #include "batches/GrTessellatingPathRenderer.h" |
27 | 27 |
28 GrPathRendererChain::GrPathRendererChain(GrContext* context, const Options& opti
ons) { | 28 GrPathRendererChain::GrPathRendererChain(GrContext* context, const Options& opti
ons) { |
29 const GrCaps& caps = *context->caps(); | 29 if (!options.fDisableAllPathRenderers) { |
30 this->addPathRenderer(new GrDashLinePathRenderer)->unref(); | 30 const GrCaps& caps = *context->caps(); |
| 31 this->addPathRenderer(new GrDashLinePathRenderer)->unref(); |
31 | 32 |
32 if (GrPathRenderer* pr = GrStencilAndCoverPathRenderer::Create(context->reso
urceProvider(), | 33 if (GrPathRenderer* pr = GrStencilAndCoverPathRenderer::Create(context->
resourceProvider(), |
33 caps)) { | 34 caps)) { |
34 this->addPathRenderer(pr)->unref(); | 35 this->addPathRenderer(pr)->unref(); |
| 36 } |
| 37 #ifndef SK_BUILD_FOR_ANDROID_FRAMEWORK |
| 38 if (caps.sampleShadingSupport()) { |
| 39 this->addPathRenderer(new GrMSAAPathRenderer)->unref(); |
| 40 } |
| 41 #endif |
| 42 this->addPathRenderer(new GrAAHairLinePathRenderer)->unref(); |
| 43 this->addPathRenderer(new GrAAConvexPathRenderer)->unref(); |
| 44 this->addPathRenderer(new GrAALinearizingConvexPathRenderer)->unref(); |
| 45 if (caps.shaderCaps()->plsPathRenderingSupport()) { |
| 46 this->addPathRenderer(new GrPLSPathRenderer)->unref(); |
| 47 } |
| 48 if (!options.fDisableDistanceFieldRenderer) { |
| 49 this->addPathRenderer(new GrAADistanceFieldPathRenderer)->unref(); |
| 50 } |
| 51 this->addPathRenderer(new GrTessellatingPathRenderer)->unref(); |
| 52 this->addPathRenderer(new GrDefaultPathRenderer(caps.twoSidedStencilSupp
ort(), |
| 53 caps.stencilWrapOpsSuppo
rt()))->unref(); |
35 } | 54 } |
36 #ifndef SK_BUILD_FOR_ANDROID_FRAMEWORK | |
37 if (caps.sampleShadingSupport()) { | |
38 this->addPathRenderer(new GrMSAAPathRenderer)->unref(); | |
39 } | |
40 #endif | |
41 this->addPathRenderer(new GrAAHairLinePathRenderer)->unref(); | |
42 this->addPathRenderer(new GrAAConvexPathRenderer)->unref(); | |
43 this->addPathRenderer(new GrAALinearizingConvexPathRenderer)->unref(); | |
44 if (caps.shaderCaps()->plsPathRenderingSupport()) { | |
45 this->addPathRenderer(new GrPLSPathRenderer)->unref(); | |
46 } | |
47 if (!options.fDisableDistanceFieldRenderer) { | |
48 this->addPathRenderer(new GrAADistanceFieldPathRenderer)->unref(); | |
49 } | |
50 this->addPathRenderer(new GrTessellatingPathRenderer)->unref(); | |
51 this->addPathRenderer(new GrDefaultPathRenderer(caps.twoSidedStencilSupport(
), | |
52 caps.stencilWrapOpsSupport()
))->unref(); | |
53 } | 55 } |
54 | 56 |
55 GrPathRendererChain::~GrPathRendererChain() { | 57 GrPathRendererChain::~GrPathRendererChain() { |
56 for (int i = 0; i < fChain.count(); ++i) { | 58 for (int i = 0; i < fChain.count(); ++i) { |
57 fChain[i]->unref(); | 59 fChain[i]->unref(); |
58 } | 60 } |
59 } | 61 } |
60 | 62 |
61 GrPathRenderer* GrPathRendererChain::addPathRenderer(GrPathRenderer* pr) { | 63 GrPathRenderer* GrPathRendererChain::addPathRenderer(GrPathRenderer* pr) { |
62 fChain.push_back() = pr; | 64 fChain.push_back() = pr; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 continue; | 98 continue; |
97 } else if (stencilSupport) { | 99 } else if (stencilSupport) { |
98 *stencilSupport = support; | 100 *stencilSupport = support; |
99 } | 101 } |
100 } | 102 } |
101 return fChain[i]; | 103 return fChain[i]; |
102 } | 104 } |
103 } | 105 } |
104 return nullptr; | 106 return nullptr; |
105 } | 107 } |
OLD | NEW |