diff options
author | Robert Phillips <robertphillips@google.com> | 2018-04-11 12:38:41 +0000 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-04-11 12:38:47 +0000 |
commit | c64ee20e135a336ed775ccb6dec8a87efd19ec02 (patch) | |
tree | 661c8d0d3ee64ff31b45548758e3c1dfe4abc81d /src/core | |
parent | 90f09e7853f506808b7dad5c50b60376887277a4 (diff) |
Revert "Fix handling of MaskFilter matrices"
This reverts commit 2097fd03ffea48bd904c48c93348b2350600870e.
Reason for revert: This is breaking a lot of Windows bots (esp. on the shadermaskfilter_localmatrix)
Original change's description:
> Fix handling of MaskFilter matrices
>
> 1) extend GrFPArgs to track pre/post local matrices, add helpers for
> creating pre/post wrapper args
>
> 2) add a SkShaderBase helper (totalLocalMatrix) to centralize the LM
> sandwich logic.
>
> 3) update call sites to use the above
>
> 4) rename SkMatrixFilter::makeWithLocalMatrix -> makeWithMatrix, to
> disambiguate vs. SkShader::makeWithLocalMatrix.
>
> BUG=skia:7744
>
> Change-Id: Ib2b7b007e6924979b00649dde7c94ef4b34771f1
> Reviewed-on: https://skia-review.googlesource.com/119330
> Commit-Queue: Florin Malita <fmalita@chromium.org>
> Reviewed-by: Brian Salomon <bsalomon@google.com>
TBR=bsalomon@google.com,robertphillips@google.com,fmalita@chromium.org,reed@google.com
Change-Id: I918dbb95bf00b3122e6699b84566ec82dbb5fc5c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:7744
Reviewed-on: https://skia-review.googlesource.com/120340
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/SkBitmapDevice.cpp | 4 | ||||
-rw-r--r-- | src/core/SkMaskFilter.cpp | 31 |
2 files changed, 22 insertions, 13 deletions
diff --git a/src/core/SkBitmapDevice.cpp b/src/core/SkBitmapDevice.cpp index 26cdc39313..5f84ba1aec 100644 --- a/src/core/SkBitmapDevice.cpp +++ b/src/core/SkBitmapDevice.cpp @@ -487,7 +487,7 @@ void SkBitmapDevice::drawDevice(SkBaseDevice* device, int x, int y, const SkPain // todo: can we unify with similar adjustment in SkGpuDevice? SkTCopyOnFirstWrite<SkPaint> paint(origPaint); if (paint->getMaskFilter()) { - paint.writable()->setMaskFilter(paint->getMaskFilter()->makeWithMatrix(this->ctm())); + paint.writable()->setMaskFilter(paint->getMaskFilter()->makeWithLocalMatrix(this->ctm())); } this->drawSprite(static_cast<SkBitmapDevice*>(device)->fBitmap, x, y, *paint); } @@ -546,7 +546,7 @@ void SkBitmapDevice::drawSpecial(SkSpecialImage* src, int x, int y, const SkPain } if (paint->getMaskFilter()) { - paint.writable()->setMaskFilter(paint->getMaskFilter()->makeWithMatrix(this->ctm())); + paint.writable()->setMaskFilter(paint->getMaskFilter()->makeWithLocalMatrix(this->ctm())); } if (!clipImage) { diff --git a/src/core/SkMaskFilter.cpp b/src/core/SkMaskFilter.cpp index 8e555f37ad..e1805637a9 100644 --- a/src/core/SkMaskFilter.cpp +++ b/src/core/SkMaskFilter.cpp @@ -635,9 +635,9 @@ void SkCombineMF::toString(SkString* str) const { /////////////////////////////////////////////////////////////////////////////////////////////////// -class SkMatrixMF : public SkMaskFilterBase { +class SkLocalMatrixMF : public SkMaskFilterBase { public: - SkMatrixMF(sk_sp<SkMaskFilter> filter, const SkMatrix& lm) + SkLocalMatrixMF(sk_sp<SkMaskFilter> filter, const SkMatrix& lm) : fFilter(std::move(filter)) , fLM(lm) {} @@ -657,7 +657,7 @@ public: SkMask::Format getFormat() const override { return as_MFB(fFilter)->getFormat(); } void toString(SkString* str) const override { - str->set("SkMatrixMF:"); + str->set("SkLocalMatrixMF:"); } SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLocalMatrixMF) @@ -665,7 +665,16 @@ public: protected: #if SK_SUPPORT_GPU std::unique_ptr<GrFragmentProcessor> onAsFragmentProcessor(const GrFPArgs& args) const override{ - return as_MFB(fFilter)->asFragmentProcessor(args.makeWithPostLocalMatrix(fLM)); + GrFPArgs newArgs = args; + + SkMatrix storage; + if (args.fLocalMatrix) { + storage.setConcat(*args.fLocalMatrix, fLM); + newArgs.fLocalMatrix = &storage; + } else { + newArgs.fLocalMatrix = &fLM; + } + return as_MFB(fFilter)->asFragmentProcessor(newArgs); } bool onHasFragmentProcessor() const override { @@ -686,11 +695,11 @@ private: typedef SkMaskFilterBase INHERITED; }; -sk_sp<SkFlattenable> SkMatrixMF::CreateProc(SkReadBuffer& buffer) { - SkMatrix m; - buffer.readMatrix(&m); +sk_sp<SkFlattenable> SkLocalMatrixMF::CreateProc(SkReadBuffer& buffer) { + SkMatrix lm; + buffer.readMatrix(&lm); auto filter = buffer.readMaskFilter(); - return filter ? filter->makeWithMatrix(m) : nullptr; + return filter ? filter->makeWithLocalMatrix(lm) : nullptr; } /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -726,16 +735,16 @@ sk_sp<SkMaskFilter> SkMaskFilter::MakeCombine(sk_sp<SkMaskFilter> dst, sk_sp<SkM return sk_sp<SkMaskFilter>(new SkCombineMF(std::move(dst), std::move(src), mode)); } -sk_sp<SkMaskFilter> SkMaskFilter::makeWithMatrix(const SkMatrix& lm) const { +sk_sp<SkMaskFilter> SkMaskFilter::makeWithLocalMatrix(const SkMatrix& lm) const { sk_sp<SkMaskFilter> me = sk_ref_sp(const_cast<SkMaskFilter*>(this)); if (lm.isIdentity()) { return me; } - return sk_sp<SkMaskFilter>(new SkMatrixMF(std::move(me), lm)); + return sk_sp<SkMaskFilter>(new SkLocalMatrixMF(std::move(me), lm)); } void SkMaskFilter::InitializeFlattenables() { - SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkMatrixMF) + SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLocalMatrixMF) SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkComposeMF) SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkCombineMF) sk_register_blur_maskfilter_createproc(); |