diff options
author | Mike Reed <reed@google.com> | 2018-02-06 16:07:51 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-02-06 21:39:45 +0000 |
commit | be33bab92b83c116cf3f62cff982a2ee7892717e (patch) | |
tree | be1562291709461bac4e8c76eb8ad590ff7d79bf /src/gpu/SkGpuDevice.cpp | |
parent | 89737decb4965ec250f02af432884366945d2e53 (diff) |
add maskfilter+localmatrix to fix savelayer
Bug: skia:7590
Change-Id: I0fcaf342f0dece9a2ddce39f72ad2694626544c7
Reviewed-on: https://skia-review.googlesource.com/104324
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
Diffstat (limited to 'src/gpu/SkGpuDevice.cpp')
-rw-r--r-- | src/gpu/SkGpuDevice.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp index 73e5f11e4a..48f05f1bec 100644 --- a/src/gpu/SkGpuDevice.cpp +++ b/src/gpu/SkGpuDevice.cpp @@ -1259,8 +1259,8 @@ sk_sp<SkSpecialImage> SkGpuDevice::snapSpecial() { } void SkGpuDevice::drawDevice(SkBaseDevice* device, - int left, int top, const SkPaint& paint) { - SkASSERT(!paint.getImageFilter()); + int left, int top, const SkPaint& origPaint) { + SkASSERT(!origPaint.getImageFilter()); ASSERT_SINGLE_OWNER // clear of the source device must occur before CHECK_SHOULD_DRAW @@ -1273,7 +1273,18 @@ void SkGpuDevice::drawDevice(SkBaseDevice* device, return; } - this->drawSpecial(srcImg.get(), left, top, paint, nullptr, SkMatrix::I()); + // todo: can we unify with similar adjustment in SkBitmapDevice? + const SkPaint* paint = &origPaint; + SkTLazy<SkPaint> lazyP; + if (origPaint.getMaskFilter()) { + SkMatrix ctm = this->ctm(); + ctm.postTranslate(-SkIntToScalar(left), -SkIntToScalar(top)); + lazyP.set(origPaint); + lazyP.get()->setMaskFilter(origPaint.getMaskFilter()->makeWithLocalMatrix(ctm)); + paint = lazyP.get(); + } + + this->drawSpecial(srcImg.get(), left, top, *paint, nullptr, SkMatrix::I()); } void SkGpuDevice::drawImage(const SkImage* image, SkScalar x, SkScalar y, const SkPaint& paint) { |