diff options
author | robertphillips <robertphillips@google.com> | 2016-07-11 10:43:58 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-07-11 10:43:58 -0700 |
commit | 8e375309caf1628aff28c58d3e87156f3f67c16c (patch) | |
tree | 82e6162122e259d14770f81ff84e6da3aab219aa /src/gpu | |
parent | 00dd4538a5c6331dfc3a52283e6ece40f0e9425d (diff) |
Simplify MSAA path renderer
This simplification is based on the observations that:
there were never more than 2 passes
the only time passes[] was null was the single-pass, !stencilOnly case
only kBoth_DrawFace was was ever used
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2135053002
Review-Url: https://codereview.chromium.org/2135053002
Diffstat (limited to 'src/gpu')
-rw-r--r-- | src/gpu/batches/GrMSAAPathRenderer.cpp | 34 |
1 files changed, 11 insertions, 23 deletions
diff --git a/src/gpu/batches/GrMSAAPathRenderer.cpp b/src/gpu/batches/GrMSAAPathRenderer.cpp index d38d88600a..39b924c1b6 100644 --- a/src/gpu/batches/GrMSAAPathRenderer.cpp +++ b/src/gpu/batches/GrMSAAPathRenderer.cpp @@ -567,9 +567,10 @@ bool GrMSAAPathRenderer::internalDrawPath(GrDrawContext* drawContext, SkPath path; shape.asPath(&path); + static const int kMaxNumPasses = 2; + int passCount = 0; - const GrUserStencilSettings* passes[3]; - GrPipelineBuilder::DrawFace drawFace[3]; + const GrUserStencilSettings* passes[kMaxNumPasses]; bool reverse = false; bool lastPassIsBounds; @@ -578,9 +579,8 @@ bool GrMSAAPathRenderer::internalDrawPath(GrDrawContext* drawContext, if (stencilOnly) { passes[0] = &gDirectToStencil; } else { - passes[0] = nullptr; + passes[0] = userStencilSettings; } - drawFace[0] = GrPipelineBuilder::kBoth_DrawFace; lastPassIsBounds = false; } else { switch (path.getFillType()) { @@ -601,7 +601,6 @@ bool GrMSAAPathRenderer::internalDrawPath(GrDrawContext* drawContext, passes[1] = &gEOColorPass; } } - drawFace[0] = drawFace[1] = GrPipelineBuilder::kBoth_DrawFace; break; case SkPath::kInverseWinding_FillType: @@ -610,17 +609,15 @@ bool GrMSAAPathRenderer::internalDrawPath(GrDrawContext* drawContext, case SkPath::kWinding_FillType: passes[0] = &gWindStencilSeparateWithWrap; passCount = 2; - drawFace[0] = GrPipelineBuilder::kBoth_DrawFace; if (stencilOnly) { lastPassIsBounds = false; - --passCount; + passCount = 1; } else { lastPassIsBounds = true; - drawFace[passCount-1] = GrPipelineBuilder::kBoth_DrawFace; if (reverse) { - passes[passCount-1] = &gInvWindColorPass; + passes[1] = &gInvWindColorPass; } else { - passes[passCount-1] = &gWindColorPass; + passes[1] = &gWindColorPass; } } break; @@ -633,6 +630,8 @@ bool GrMSAAPathRenderer::internalDrawPath(GrDrawContext* drawContext, SkRect devBounds; GetPathDevBounds(path, drawContext->width(), drawContext->height(), viewMatrix, &devBounds); + SkASSERT(passCount <= kMaxNumPasses); + for (int p = 0; p < passCount; ++p) { if (lastPassIsBounds && (p == passCount-1)) { SkRect bounds; @@ -658,14 +657,8 @@ bool GrMSAAPathRenderer::internalDrawPath(GrDrawContext* drawContext, GrRectBatchFactory::CreateNonAAFill(paint.getColor(), viewM, bounds, nullptr, &localMatrix)); - SkASSERT(GrPipelineBuilder::kBoth_DrawFace == drawFace[p]); GrPipelineBuilder pipelineBuilder(paint, drawContext->mustUseHWAA(paint)); - pipelineBuilder.setDrawFace(drawFace[p]); - if (passes[p]) { - pipelineBuilder.setUserStencil(passes[p]); - } else { - pipelineBuilder.setUserStencil(userStencilSettings); - } + pipelineBuilder.setUserStencil(passes[p]); drawContext->drawBatch(pipelineBuilder, clip, batch); } else { @@ -676,12 +669,7 @@ bool GrMSAAPathRenderer::internalDrawPath(GrDrawContext* drawContext, } GrPipelineBuilder pipelineBuilder(paint, drawContext->mustUseHWAA(paint)); - pipelineBuilder.setDrawFace(drawFace[p]); - if (passes[p]) { - pipelineBuilder.setUserStencil(passes[p]); - } else { - pipelineBuilder.setUserStencil(userStencilSettings); - } + pipelineBuilder.setUserStencil(passes[p]); if (passCount > 1) { pipelineBuilder.setDisableColorXPFactory(); } |