Index: include/effects/SkDropShadowImageFilter.h |
diff --git a/include/effects/SkDropShadowImageFilter.h b/include/effects/SkDropShadowImageFilter.h |
index 7f1aa332208c62a79e1849c6fb1759fe12d0da36..a4726f3247f8207b78c5bf157de375034d9a3c1b 100644 |
--- a/include/effects/SkDropShadowImageFilter.h |
+++ b/include/effects/SkDropShadowImageFilter.h |
@@ -23,17 +23,30 @@ public: |
static const int kShadowModeCount = kLast_ShadowMode+1; |
- static SkImageFilter* Create(SkScalar dx, SkScalar dy, SkScalar sigmaX, SkScalar sigmaY, |
- SkColor color, ShadowMode shadowMode, SkImageFilter* input = NULL, |
- const CropRect* cropRect = NULL) { |
- return new SkDropShadowImageFilter(dx, dy, sigmaX, sigmaY, color, shadowMode, input, |
- cropRect); |
+ static sk_sp<SkImageFilter> Make(SkScalar dx, SkScalar dy, SkScalar sigmaX, SkScalar sigmaY, |
+ SkColor color, ShadowMode shadowMode, |
+ sk_sp<SkImageFilter> input, |
+ const CropRect* cropRect = nullptr) { |
+ return sk_sp<SkImageFilter>(new SkDropShadowImageFilter(dx, dy, sigmaX, sigmaY, |
+ color, shadowMode, |
+ std::move(input), |
+ cropRect)); |
} |
SkRect computeFastBounds(const SkRect&) const override; |
SK_TO_STRING_OVERRIDE() |
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDropShadowImageFilter) |
+#ifdef SK_SUPPORT_LEGACY_IMAGEFILTER_PTR |
+ static SkImageFilter* Create(SkScalar dx, SkScalar dy, SkScalar sigmaX, SkScalar sigmaY, |
+ SkColor color, ShadowMode shadowMode, |
+ SkImageFilter* input = nullptr, |
+ const CropRect* cropRect = nullptr) { |
+ return Make(dx, dy, sigmaX, sigmaY, color, shadowMode, |
+ sk_ref_sp<SkImageFilter>(input), cropRect).release(); |
+ } |
+#endif |
+ |
protected: |
void flatten(SkWriteBuffer&) const override; |
sk_sp<SkSpecialImage> onFilterImage(SkSpecialImage* source, const Context&, |
@@ -42,7 +55,8 @@ protected: |
private: |
SkDropShadowImageFilter(SkScalar dx, SkScalar dy, SkScalar sigmaX, SkScalar sigmaY, SkColor, |
- ShadowMode shadowMode, SkImageFilter* input, const CropRect* cropRect); |
+ ShadowMode shadowMode, sk_sp<SkImageFilter> input, |
+ const CropRect* cropRect); |
SkScalar fDx, fDy, fSigmaX, fSigmaY; |
SkColor fColor; |