aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/effects/SkTestImageFilters.h
diff options
context:
space:
mode:
authorGravatar robertphillips <robertphillips@google.com>2016-04-06 07:44:01 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-04-06 07:44:01 -0700
commitfc0f44a5f0a4001b894ecf357bbed2a0d93058c1 (patch)
tree824ea5dc223a13b1836bd564f3c0ca5f89a0f1b6 /include/effects/SkTestImageFilters.h
parent898235c4864df66aa7f6d32bc2a8b8551040ce1e (diff)
Update DownSampleImageFilter to sk_sp
Diffstat (limited to 'include/effects/SkTestImageFilters.h')
-rw-r--r--include/effects/SkTestImageFilters.h18
1 files changed, 12 insertions, 6 deletions
diff --git a/include/effects/SkTestImageFilters.h b/include/effects/SkTestImageFilters.h
index 943bb53356..0f89759c1c 100644
--- a/include/effects/SkTestImageFilters.h
+++ b/include/effects/SkTestImageFilters.h
@@ -14,20 +14,26 @@
// Fun mode that scales down (only) and then scales back up to look pixelated
class SK_API SkDownSampleImageFilter : public SkImageFilter {
public:
- static SkImageFilter* Create(SkScalar scale, SkImageFilter* input = NULL) {
+ static sk_sp<SkImageFilter> Make(SkScalar scale, sk_sp<SkImageFilter> input) {
if (!SkScalarIsFinite(scale)) {
- return NULL;
+ return nullptr;
}
// we don't support scale in this range
if (scale > SK_Scalar1 || scale <= 0) {
- return NULL;
+ return nullptr;
}
- return new SkDownSampleImageFilter(scale, input);
+ return sk_sp<SkImageFilter>(new SkDownSampleImageFilter(scale, std::move(input)));
}
SK_TO_STRING_OVERRIDE()
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDownSampleImageFilter)
+#ifdef SK_SUPPORT_LEGACY_IMAGEFILTER_PTR
+ static SkImageFilter* Create(SkScalar scale, SkImageFilter* input = nullptr) {
+ return Make(scale, sk_ref_sp<SkImageFilter>(input)).release();
+ }
+#endif
+
protected:
void flatten(SkWriteBuffer&) const override;
@@ -35,8 +41,8 @@ protected:
SkIPoint* offset) const override;
private:
- SkDownSampleImageFilter(SkScalar scale, SkImageFilter* input)
- : INHERITED(1, &input), fScale(scale) {}
+ SkDownSampleImageFilter(SkScalar scale, sk_sp<SkImageFilter> input)
+ : INHERITED(&input, 1, nullptr), fScale(scale) {}
SkScalar fScale;