aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkLocalMatrixImageFilter.h
diff options
context:
space:
mode:
authorGravatar robertphillips <robertphillips@google.com>2016-03-30 07:32:28 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-03-30 07:32:28 -0700
commit372177ee115d46dfb5bfb881a408e6c37ae83678 (patch)
tree674a01098b007017b989cf8d350398a0c794a345 /src/core/SkLocalMatrixImageFilter.h
parent2e77ddbb5e7274a83724ceaa5680f367e54163d4 (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;