| 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) { | 28 GrPathRendererChain::GrPathRendererChain(GrContext* context, const Options& opti
ons) { |
| 29 const GrCaps& caps = *context->caps(); | 29 const GrCaps& caps = *context->caps(); |
| 30 this->addPathRenderer(new GrDashLinePathRenderer)->unref(); | 30 this->addPathRenderer(new GrDashLinePathRenderer)->unref(); |
| 31 | 31 |
| 32 if (GrPathRenderer* pr = GrStencilAndCoverPathRenderer::Create(context->reso
urceProvider(), | 32 if (GrPathRenderer* pr = GrStencilAndCoverPathRenderer::Create(context->reso
urceProvider(), |
| 33 caps)) { | 33 caps)) { |
| 34 this->addPathRenderer(pr)->unref(); | 34 this->addPathRenderer(pr)->unref(); |
| 35 } | 35 } |
| 36 #ifndef SK_BUILD_FOR_ANDROID_FRAMEWORK | 36 #ifndef SK_BUILD_FOR_ANDROID_FRAMEWORK |
| 37 if (caps.sampleShadingSupport()) { | 37 if (caps.sampleShadingSupport()) { |
| 38 this->addPathRenderer(new GrMSAAPathRenderer)->unref(); | 38 this->addPathRenderer(new GrMSAAPathRenderer)->unref(); |
| 39 } | 39 } |
| 40 #endif | 40 #endif |
| 41 this->addPathRenderer(new GrAAHairLinePathRenderer)->unref(); | 41 this->addPathRenderer(new GrAAHairLinePathRenderer)->unref(); |
| 42 this->addPathRenderer(new GrAAConvexPathRenderer)->unref(); | 42 this->addPathRenderer(new GrAAConvexPathRenderer)->unref(); |
| 43 this->addPathRenderer(new GrAALinearizingConvexPathRenderer)->unref(); | 43 this->addPathRenderer(new GrAALinearizingConvexPathRenderer)->unref(); |
| 44 if (caps.shaderCaps()->plsPathRenderingSupport()) { | 44 if (caps.shaderCaps()->plsPathRenderingSupport()) { |
| 45 this->addPathRenderer(new GrPLSPathRenderer)->unref(); | 45 this->addPathRenderer(new GrPLSPathRenderer)->unref(); |
| 46 } | 46 } |
| 47 this->addPathRenderer(new GrAADistanceFieldPathRenderer)->unref(); | 47 if (!options.fDisableDistanceFieldRenderer) { |
| 48 this->addPathRenderer(new GrAADistanceFieldPathRenderer)->unref(); |
| 49 } |
| 48 this->addPathRenderer(new GrTessellatingPathRenderer)->unref(); | 50 this->addPathRenderer(new GrTessellatingPathRenderer)->unref(); |
| 49 this->addPathRenderer(new GrDefaultPathRenderer(caps.twoSidedStencilSupport(
), | 51 this->addPathRenderer(new GrDefaultPathRenderer(caps.twoSidedStencilSupport(
), |
| 50 caps.stencilWrapOpsSupport()
))->unref(); | 52 caps.stencilWrapOpsSupport()
))->unref(); |
| 51 } | 53 } |
| 52 | 54 |
| 53 GrPathRendererChain::~GrPathRendererChain() { | 55 GrPathRendererChain::~GrPathRendererChain() { |
| 54 for (int i = 0; i < fChain.count(); ++i) { | 56 for (int i = 0; i < fChain.count(); ++i) { |
| 55 fChain[i]->unref(); | 57 fChain[i]->unref(); |
| 56 } | 58 } |
| 57 } | 59 } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 continue; | 96 continue; |
| 95 } else if (stencilSupport) { | 97 } else if (stencilSupport) { |
| 96 *stencilSupport = support; | 98 *stencilSupport = support; |
| 97 } | 99 } |
| 98 } | 100 } |
| 99 return fChain[i]; | 101 return fChain[i]; |
| 100 } | 102 } |
| 101 } | 103 } |
| 102 return nullptr; | 104 return nullptr; |
| 103 } | 105 } |
| OLD | NEW |