Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(406)

Unified Diff: src/gpu/batches/GrMSAAPathRenderer.cpp

Issue 2135053002: Simplify MSAA path renderer (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/batches/GrMSAAPathRenderer.cpp
diff --git a/src/gpu/batches/GrMSAAPathRenderer.cpp b/src/gpu/batches/GrMSAAPathRenderer.cpp
index d38d88600a4874dbe704a9f7f2a02f60778eb0fd..39b924c1b670ca136644d3eca25862083101de2f 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();
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698