diff options
author | Robert Phillips <robertphillips@google.com> | 2018-04-23 08:15:05 -0400 |
---|---|---|
committer | Robert Phillips <robertphillips@google.com> | 2018-04-23 12:54:28 +0000 |
commit | e9f2bbe082e9e1eb9d76e3043adedc9443427d8d (patch) | |
tree | 1b110a9d779ffc78c2fa2900da203724162969a6 /tests | |
parent | 78fb04e69eaef269c3a579614ae049deb065b4b1 (diff) |
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>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/BlurTest.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/BlurTest.cpp b/tests/BlurTest.cpp index e0ce22e3d6..07cfdcd2b1 100644 --- a/tests/BlurTest.cpp +++ b/tests/BlurTest.cpp @@ -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 + |