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>
This commit is contained in:
Brian Salomon 2016-12-10 09:35:48 -05:00 committed by Skia Commit-Bot
parent 72245c522a
commit 82125e9aa2
6 changed files with 20 additions and 40 deletions

View File

@ -118,17 +118,9 @@ bool GrClipStackClip::PathNeedsSWRenderer(GrContext* context,
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;

View File

@ -40,10 +40,10 @@ public:
* 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

View File

@ -75,10 +75,9 @@ GrPathRenderer* GrPathRendererChain::getPathRenderer(
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;

View File

@ -34,13 +34,10 @@ public:
/** 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

View File

@ -744,8 +744,7 @@ bool GrReducedClip::drawStencilClipMask(GrContext* context,
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;

View File

@ -1452,10 +1452,6 @@ bool GrRenderTargetContextPriv::drawAndStencilPath(const GrClip& clip,
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 @@ bool GrRenderTargetContextPriv::drawAndStencilPath(const GrClip& clip,
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 @@ void GrRenderTargetContext::internalDrawPath(const GrClip& clip,
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 @@ void GrRenderTargetContext::internalDrawPath(const GrClip& clip,
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 @@ void GrRenderTargetContext::internalDrawPath(const GrClip& clip,
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 @@ void GrRenderTargetContext::internalDrawPath(const GrClip& clip,
}
}
// 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