diff options
author | robertphillips <robertphillips@google.com> | 2016-03-29 13:54:26 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-03-29 13:54:26 -0700 |
commit | a33cf07a2273315363c0b6fb5d3ce811742f5a85 (patch) | |
tree | c3eab040c77ea20073c82c3eaa3711f203468d6d /src/core/SkLocalMatrixImageFilter.h | |
parent | 9b2ef62d4708081979ff954e1ac0623d1d4ffada (diff) |
Switch SkLocalMatrixImageFilter and SkPaintImageFilter over to sk_sp
TBR=reed@google.com
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1842793002
Review URL: https://codereview.chromium.org/1842793002
Diffstat (limited to 'src/core/SkLocalMatrixImageFilter.h')
-rw-r--r-- | src/core/SkLocalMatrixImageFilter.h | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/core/SkLocalMatrixImageFilter.h b/src/core/SkLocalMatrixImageFilter.h index 412b391e18..eb112b0f0d 100644 --- a/src/core/SkLocalMatrixImageFilter.h +++ b/src/core/SkLocalMatrixImageFilter.h @@ -16,11 +16,28 @@ */ class SkLocalMatrixImageFilter : public SkImageFilter { public: - static SkImageFilter* Create(const SkMatrix& localM, SkImageFilter* input); + static sk_sp<SkImageFilter> Make(const SkMatrix& localM, sk_sp<SkImageFilter> input) { + if (!input) { + return nullptr; + } + if (localM.getType() & (SkMatrix::kAffine_Mask | SkMatrix::kPerspective_Mask)) { + return nullptr; + } + if (localM.isIdentity()) { + return input; + } + return sk_sp<SkImageFilter>(new SkLocalMatrixImageFilter(localM, input)); + } SK_TO_STRING_OVERRIDE() SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLocalMatrixImageFilter) +#ifdef SK_SUPPORT_LEGACY_IMAGEFILTER_PTR + static SkImageFilter* Create(const SkMatrix& localM, SkImageFilter* input) { + return Make(localM, sk_sp<SkImageFilter>(SkSafeRef(input))).release(); + } +#endif + protected: void flatten(SkWriteBuffer&) const override; sk_sp<SkSpecialImage> onFilterImage(SkSpecialImage* source, const Context&, @@ -28,7 +45,7 @@ protected: SkIRect onFilterBounds(const SkIRect& src, const SkMatrix&, MapDirection) const override; private: - SkLocalMatrixImageFilter(const SkMatrix& localM, SkImageFilter* input); + SkLocalMatrixImageFilter(const SkMatrix& localM, sk_sp<SkImageFilter> input); SkMatrix fLocalM; |