Reland "Prevent masked solid-color draws from being turned into clears"

This reverts commit f92bb3785f.

Reason for revert: The new unit test has been suppressed on ANGLE

Original change's description:
> Revert "Prevent masked solid-color draws from being turned into clears"
> 
> This reverts commit e9f2bbe082.
> 
> Reason for revert: ANGLE
> 
> Original change's description:
> > Prevent masked solid-color draws from being turned into clears
> > 
> > GrRenderTargetContext::drawRect was eliding a BlurMask filtered circle.
> > 
> > Bug: skia:7765
> > Change-Id: Id98c059f7d786ee5c9bca839c8e099997ff2aedb
> > Reviewed-on: https://skia-review.googlesource.com/122793
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
> 
> TBR=bsalomon@google.com,robertphillips@google.com
> 
> Change-Id: I1b7752eab0fcf55ab6248eed587fd85d438efd78
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:7765
> Reviewed-on: https://skia-review.googlesource.com/122960
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Commit-Queue: Robert Phillips <robertphillips@google.com>

TBR=bsalomon@google.com,robertphillips@google.com

Change-Id: If432c24548ef0f6df4fd6a06aa3b1fb38ba793b8
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:7765
Reviewed-on: https://skia-review.googlesource.com/123000
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
This commit is contained in:
Robert Phillips 2018-04-23 15:12:00 +00:00 committed by Skia Commit-Bot
parent a96a101071
commit c90b4dbec5
2 changed files with 37 additions and 1 deletions

View File

@ -503,7 +503,7 @@ void GrRenderTargetContext::drawRect(const GrClip& clip,
AutoCheckFlush acf(this->drawingManager());
const SkStrokeRec& stroke = style->strokeRec();
if (stroke.getStyle() == SkStrokeRec::kFill_Style) {
if (stroke.getStyle() == SkStrokeRec::kFill_Style && !paint.numCoverageFragmentProcessors()) {
// Check if this is a full RT draw and can be replaced with a clear. We don't bother
// checking cases where the RT is fully inside a stroke.
SkRect rtRect = fRenderTargetProxy->getBoundsRect();

View File

@ -708,3 +708,39 @@ DEF_TEST(BlurZeroSigma, reporter) {
}
}
///////////////////////////////////////////////////////////////////////////////////////////
#if SK_SUPPORT_GPU
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(BlurMaskBiggerThanDest, reporter, ctxInfo) {
GrContext* context = ctxInfo.grContext();
SkImageInfo ii = SkImageInfo::Make(32, 32, kRGBA_8888_SkColorType, kPremul_SkAlphaType);
sk_sp<SkSurface> dst(SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, ii));
if (!dst) {
ERRORF(reporter, "Could not create surface for test.");
return;
}
SkPaint p;
p.setColor(SK_ColorRED);
p.setMaskFilter(SkMaskFilter::MakeBlur(kNormal_SkBlurStyle, 3));
SkCanvas* canvas = dst->getCanvas();
canvas->clear(SK_ColorBLACK);
canvas->drawCircle(SkPoint::Make(16, 16), 8, p);
SkBitmap readback;
SkAssertResult(readback.tryAllocPixels(ii));
canvas->readPixels(readback, 0, 0);
REPORTER_ASSERT(reporter, SkColorGetR(readback.getColor(15, 15)) > 128);
REPORTER_ASSERT(reporter, SkColorGetG(readback.getColor(15, 15)) == 0);
REPORTER_ASSERT(reporter, SkColorGetB(readback.getColor(15, 15)) == 0);
REPORTER_ASSERT(reporter, readback.getColor(31, 31) == SK_ColorBLACK);
}
#endif