Remove antialias axis from GrPathRendererChain::DrawType
Change-Id: I910ef57027059c3c7dd780ba9de40363c201e174
Reviewed-on: https://skia-review.googlesource.com/5728
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/GrClipStackClip.cpp b/src/gpu/GrClipStackClip.cpp
index 9fc2182..fae01ce 100644
--- a/src/gpu/GrClipStackClip.cpp
+++ b/src/gpu/GrClipStackClip.cpp
@@ -118,17 +118,9 @@
path.toggleInverseFillType();
}
- GrPathRendererChain::DrawType type;
-
- if (needsStencil) {
- type = element->isAA()
- ? GrPathRendererChain::kStencilAndColorAntiAlias_DrawType
- : GrPathRendererChain::kStencilAndColor_DrawType;
- } else {
- type = element->isAA()
- ? GrPathRendererChain::kColorAntiAlias_DrawType
- : GrPathRendererChain::kColor_DrawType;
- }
+ GrPathRendererChain::DrawType type =
+ needsStencil ? GrPathRendererChain::DrawType::kStencilAndColor
+ : GrPathRendererChain::DrawType::kColor;
GrShape shape(path, GrStyle::SimpleFill());
GrPathRenderer::CanDrawPathArgs canDrawArgs;
diff --git a/src/gpu/GrPathRenderer.h b/src/gpu/GrPathRenderer.h
index c002c12..8548087 100644
--- a/src/gpu/GrPathRenderer.h
+++ b/src/gpu/GrPathRenderer.h
@@ -40,10 +40,10 @@
* rendered into the stencil.
*
* A GrPathRenderer can provide three levels of support for stenciling paths:
- * 1) kNoRestriction: This is the most general. The caller sets up the GrPipelineBuilder on the target
- * and calls drawPath(). The path is rendered exactly as the draw state
- * indicates including support for simultaneous color and stenciling with
- * arbitrary stenciling rules. Pixels partially covered by AA paths are
+ * 1) kNoRestriction: This is the most general. The caller sets up the GrPipelineBuilder on the
+ * target and calls drawPath(). The path is rendered exactly as the draw
+ * state indicates including support for simultaneous color and stenciling
+ * with arbitrary stenciling rules. Pixels partially covered by AA paths are
* affected by the stencil settings.
* 2) kStencilOnly: The path renderer cannot apply arbitrary stencil rules nor shade and stencil
* simultaneously. The path renderer does support the stencilPath() function
diff --git a/src/gpu/GrPathRendererChain.cpp b/src/gpu/GrPathRendererChain.cpp
index 05f47fd..ee31686 100644
--- a/src/gpu/GrPathRendererChain.cpp
+++ b/src/gpu/GrPathRendererChain.cpp
@@ -75,10 +75,9 @@
GR_STATIC_ASSERT(GrPathRenderer::kStencilOnly_StencilSupport <
GrPathRenderer::kNoRestriction_StencilSupport);
GrPathRenderer::StencilSupport minStencilSupport;
- if (kStencilOnly_DrawType == drawType) {
+ if (DrawType::kStencil == drawType) {
minStencilSupport = GrPathRenderer::kStencilOnly_StencilSupport;
- } else if (kStencilAndColor_DrawType == drawType ||
- kStencilAndColorAntiAlias_DrawType == drawType) {
+ } else if (DrawType::kStencilAndColor == drawType) {
minStencilSupport = GrPathRenderer::kNoRestriction_StencilSupport;
} else {
minStencilSupport = GrPathRenderer::kNoSupport_StencilSupport;
diff --git a/src/gpu/GrPathRendererChain.h b/src/gpu/GrPathRendererChain.h
index 8788374..9a1a8fe 100644
--- a/src/gpu/GrPathRendererChain.h
+++ b/src/gpu/GrPathRendererChain.h
@@ -34,13 +34,10 @@
/** Documents how the caller plans to use a GrPathRenderer to draw a path. It affects the PR
returned by getPathRenderer */
- enum DrawType {
- kColor_DrawType, // draw to the color buffer, no AA
- kColorAntiAlias_DrawType, // draw to color buffer, with partial coverage AA
- kStencilOnly_DrawType, // draw just to the stencil buffer
- kStencilAndColor_DrawType, // draw the stencil and color buffer, no AA
- kStencilAndColorAntiAlias_DrawType // draw the stencil and color buffer, with partial
- // coverage AA.
+ enum class DrawType {
+ kColor, // draw to the color buffer, no AA
+ kStencil, // draw just to the stencil buffer
+ kStencilAndColor, // draw the stencil and color buffer, no AA
};
/** Returns a GrPathRenderer compatible with the request if one is available. If the caller
diff --git a/src/gpu/GrReducedClip.cpp b/src/gpu/GrReducedClip.cpp
index fd61686..9802f87 100644
--- a/src/gpu/GrReducedClip.cpp
+++ b/src/gpu/GrReducedClip.cpp
@@ -744,8 +744,7 @@
canDrawArgs.fHasUserStencilSettings = false;
GrDrawingManager* dm = context->contextPriv().drawingManager();
- pr = dm->getPathRenderer(canDrawArgs, false,
- GrPathRendererChain::kStencilOnly_DrawType,
+ pr = dm->getPathRenderer(canDrawArgs, false, GrPathRendererChain::DrawType::kStencil,
&stencilSupport);
if (!pr) {
return false;
diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp
index 8481e1c..0a49dd3 100644
--- a/src/gpu/GrRenderTargetContext.cpp
+++ b/src/gpu/GrRenderTargetContext.cpp
@@ -1452,10 +1452,6 @@
GrAAType aaType = fRenderTargetContext->decideAAType(aa);
bool hasUserStencilSettings = !ss->isUnused();
- const GrPathRendererChain::DrawType type = (GrAAType::kCoverage == aaType)
- ? GrPathRendererChain::kColorAntiAlias_DrawType
- : GrPathRendererChain::kColor_DrawType;
-
GrShape shape(path, GrStyle::SimpleFill());
GrPathRenderer::CanDrawPathArgs canDrawArgs;
canDrawArgs.fShaderCaps =
@@ -1466,8 +1462,8 @@
canDrawArgs.fHasUserStencilSettings = hasUserStencilSettings;
// Don't allow the SW renderer
- GrPathRenderer* pr = fRenderTargetContext->fDrawingManager->getPathRenderer(canDrawArgs, false,
- type);
+ GrPathRenderer* pr = fRenderTargetContext->fDrawingManager->getPathRenderer(
+ canDrawArgs, false, GrPathRendererChain::DrawType::kColor);
if (!pr) {
return false;
}
@@ -1527,11 +1523,8 @@
canDrawArgs.fHasUserStencilSettings = false;
GrPathRenderer* pr;
+ static constexpr GrPathRendererChain::DrawType kType = GrPathRendererChain::DrawType::kColor;
do {
- const GrPathRendererChain::DrawType type = GrAAType::kCoverage == aaType
- ? GrPathRendererChain::kColorAntiAlias_DrawType
- : GrPathRendererChain::kColor_DrawType;
-
shape = GrShape(path, style);
if (shape.isEmpty()) {
return;
@@ -1540,7 +1533,7 @@
canDrawArgs.fAAType = aaType;
// Try a 1st time without applying any of the style to the geometry (and barring sw)
- pr = fDrawingManager->getPathRenderer(canDrawArgs, false, type);
+ pr = fDrawingManager->getPathRenderer(canDrawArgs, false, kType);
SkScalar styleScale = GrStyle::MatrixToScaleFactor(viewMatrix);
if (!pr && shape.style().pathEffect()) {
@@ -1549,7 +1542,7 @@
if (shape.isEmpty()) {
return;
}
- pr = fDrawingManager->getPathRenderer(canDrawArgs, false, type);
+ pr = fDrawingManager->getPathRenderer(canDrawArgs, false, kType);
}
if (!pr) {
if (shape.style().applies()) {
@@ -1559,7 +1552,7 @@
}
}
// This time, allow SW renderer
- pr = fDrawingManager->getPathRenderer(canDrawArgs, true, type);
+ pr = fDrawingManager->getPathRenderer(canDrawArgs, true, kType);
}
if (!pr && (aaType == GrAAType::kMixedSamples || aaType == GrAAType::kMSAA)) {
// There are exceptional cases where we may wind up falling back to coverage based AA