Index: src/gpu/GrPathRendererChain.cpp |
diff --git a/src/gpu/GrPathRendererChain.cpp b/src/gpu/GrPathRendererChain.cpp |
index 63195c641488808812114ea5a8ffe8212ba2dda8..e13e6c658488c4b2aa3243c98f290765c187a130 100644 |
--- a/src/gpu/GrPathRendererChain.cpp |
+++ b/src/gpu/GrPathRendererChain.cpp |
@@ -22,9 +22,21 @@ |
#include "batches/GrStencilAndCoverPathRenderer.h" |
#include "batches/GrTessellatingPathRenderer.h" |
-GrPathRendererChain::GrPathRendererChain(GrContext* context) |
- : fInit(false) |
- , fOwner(context) { |
+GrPathRendererChain::GrPathRendererChain(GrContext* context) { |
+ const GrCaps& caps = *context->caps(); |
+ this->addPathRenderer(new GrDashLinePathRenderer)->unref(); |
+ |
+ if (GrPathRenderer* pr = GrStencilAndCoverPathRenderer::Create(context->resourceProvider(), |
+ caps)) { |
+ this->addPathRenderer(pr)->unref(); |
+ } |
+ this->addPathRenderer(new GrTessellatingPathRenderer)->unref(); |
+ this->addPathRenderer(new GrAAHairLinePathRenderer)->unref(); |
+ this->addPathRenderer(new GrAAConvexPathRenderer)->unref(); |
+ this->addPathRenderer(new GrAALinearizingConvexPathRenderer)->unref(); |
+ this->addPathRenderer(new GrAADistanceFieldPathRenderer)->unref(); |
+ this->addPathRenderer(new GrDefaultPathRenderer(caps.twoSidedStencilSupport(), |
+ caps.stencilWrapOpsSupport()))->unref(); |
} |
GrPathRendererChain::~GrPathRendererChain() { |
@@ -42,10 +54,6 @@ GrPathRenderer* GrPathRendererChain::addPathRenderer(GrPathRenderer* pr) { |
GrPathRenderer* GrPathRendererChain::getPathRenderer(const GrPathRenderer::CanDrawPathArgs& args, |
DrawType drawType, |
GrPathRenderer::StencilSupport* stencilSupport) { |
- if (!fInit) { |
- this->init(); |
- } |
- |
GR_STATIC_ASSERT(GrPathRenderer::kNoSupport_StencilSupport < |
GrPathRenderer::kStencilOnly_StencilSupport); |
GR_STATIC_ASSERT(GrPathRenderer::kStencilOnly_StencilSupport < |
@@ -60,7 +68,6 @@ GrPathRenderer* GrPathRendererChain::getPathRenderer(const GrPathRenderer::CanDr |
minStencilSupport = GrPathRenderer::kNoSupport_StencilSupport; |
} |
- |
for (int i = 0; i < fChain.count(); ++i) { |
if (fChain[i]->canDrawPath(args)) { |
if (GrPathRenderer::kNoSupport_StencilSupport != minStencilSupport) { |
@@ -77,22 +84,3 @@ GrPathRenderer* GrPathRendererChain::getPathRenderer(const GrPathRenderer::CanDr |
} |
return nullptr; |
} |
- |
-void GrPathRendererChain::init() { |
- SkASSERT(!fInit); |
- const GrCaps& caps = *fOwner->caps(); |
- this->addPathRenderer(new GrDashLinePathRenderer)->unref(); |
- |
- if (GrPathRenderer* pr = GrStencilAndCoverPathRenderer::Create(fOwner->resourceProvider(), |
- caps)) { |
- this->addPathRenderer(pr)->unref(); |
- } |
- this->addPathRenderer(new GrTessellatingPathRenderer)->unref(); |
- this->addPathRenderer(new GrAAHairLinePathRenderer)->unref(); |
- this->addPathRenderer(new GrAAConvexPathRenderer)->unref(); |
- this->addPathRenderer(new GrAALinearizingConvexPathRenderer)->unref(); |
- this->addPathRenderer(new GrAADistanceFieldPathRenderer)->unref(); |
- this->addPathRenderer(new GrDefaultPathRenderer(caps.twoSidedStencilSupport(), |
- caps.stencilWrapOpsSupport()))->unref(); |
- fInit = true; |
-} |