aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkLocalMatrixImageFilter.h
diff options
context:
space:
mode:
authorGravatar robertphillips <robertphillips@google.com>2016-03-29 13:54:26 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-03-29 13:54:26 -0700
commita33cf07a2273315363c0b6fb5d3ce811742f5a85 (patch)
treec3eab040c77ea20073c82c3eaa3711f203468d6d /src/core/SkLocalMatrixImageFilter.h
parent9b2ef62d4708081979ff954e1ac0623d1d4ffada (diff)
Switch SkLocalMatrixImageFilter and SkPaintImageFilter over to sk_sp
Diffstat (limited to 'src/core/SkLocalMatrixImageFilter.h')
-rw-r--r--src/core/SkLocalMatrixImageFilter.h21
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;