Fix GrDrawContextPriv::stencilRect
Updates stencilRect to call drawNonAAFilledRect instead of
drawFilledRect. drawFilledRect can use coverage AA, which isn't
appropriate for stencil draws. Also modifies drawNonAAFilledRect to
take a "useHWAA" argument instead of trying to deduce whether it
should be used.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2187583002
Review-Url: https://codereview.chromium.org/2187583002
diff --git a/include/gpu/GrDrawContext.h b/include/gpu/GrDrawContext.h
index e305cc11..948577c 100644
--- a/include/gpu/GrDrawContext.h
+++ b/include/gpu/GrDrawContext.h
@@ -347,7 +347,8 @@
const SkRect& rect,
const SkRect* localRect,
const SkMatrix* localMatrix,
- const GrUserStencilSettings* ss);
+ const GrUserStencilSettings* ss,
+ bool useHWAA);
void internalDrawPath(const GrClip& clip,
const GrPaint& paint,
diff --git a/src/gpu/GrDrawContext.cpp b/src/gpu/GrDrawContext.cpp
index 266c50d..fedb397 100644
--- a/src/gpu/GrDrawContext.cpp
+++ b/src/gpu/GrDrawContext.cpp
@@ -277,7 +277,8 @@
AutoCheckFlush acf(fDrawingManager);
- this->drawNonAAFilledRect(clip, *paint, SkMatrix::I(), r, nullptr, &localMatrix, nullptr);
+ this->drawNonAAFilledRect(clip, *paint, SkMatrix::I(), r, nullptr, &localMatrix, nullptr,
+ false /* useHWAA */);
}
}
@@ -399,7 +400,8 @@
}
}
} else {
- this->drawNonAAFilledRect(clip, paint, viewMatrix, croppedRect, nullptr, nullptr, ss);
+ this->drawNonAAFilledRect(clip, paint, viewMatrix, croppedRect, nullptr, nullptr, ss,
+ useHWAA);
return true;
}
@@ -566,9 +568,7 @@
paint.setAntiAlias(useHWAA);
paint.setXPFactory(GrDisableColorXPFactory::Make());
- SkASSERT(!useHWAA || fDrawContext->isStencilBufferMultisampled());
-
- fDrawContext->drawFilledRect(clip, paint, viewMatrix, rect, ss);
+ fDrawContext->drawNonAAFilledRect(clip, paint, viewMatrix, rect, nullptr, nullptr, ss, useHWAA);
}
bool GrDrawContextPriv::drawAndStencilRect(const GrFixedClip& clip,
@@ -631,7 +631,7 @@
if (!should_apply_coverage_aa(paint, fRenderTarget.get(), &useHWAA)) {
this->drawNonAAFilledRect(clip, paint, viewMatrix, croppedRect, &croppedLocalRect,
- nullptr, nullptr);
+ nullptr, nullptr, useHWAA);
return;
}
@@ -689,7 +689,7 @@
if (!should_apply_coverage_aa(paint, fRenderTarget.get(), &useHWAA)) {
this->drawNonAAFilledRect(clip, paint, viewMatrix, croppedRect, nullptr,
- &localMatrix, nullptr);
+ &localMatrix, nullptr, useHWAA);
return;
}
@@ -1025,11 +1025,13 @@
const SkRect& rect,
const SkRect* localRect,
const SkMatrix* localMatrix,
- const GrUserStencilSettings* ss) {
+ const GrUserStencilSettings* ss,
+ bool useHWAA) {
+ SkASSERT(!useHWAA || this->isStencilBufferMultisampled());
SkAutoTUnref<GrDrawBatch> batch(
GrRectBatchFactory::CreateNonAAFill(paint.getColor(), viewMatrix, rect, localRect,
localMatrix));
- GrPipelineBuilder pipelineBuilder(paint, this->mustUseHWAA(paint));
+ GrPipelineBuilder pipelineBuilder(paint, useHWAA);
if (ss) {
pipelineBuilder.setUserStencil(ss);
}