Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(151)

Side by Side Diff: include/effects/SkOffsetImageFilter.h

Issue 1842193002: Update SkOffsetImageFilter to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update to ToT Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « gm/xfermodeimagefilter.cpp ('k') | samplecode/SampleFilterFuzz.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 The Android Open Source Project 2 * Copyright 2012 The Android Open Source Project
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef SkOffsetImageFilter_DEFINED 8 #ifndef SkOffsetImageFilter_DEFINED
9 #define SkOffsetImageFilter_DEFINED 9 #define SkOffsetImageFilter_DEFINED
10 10
11 #include "SkImageFilter.h" 11 #include "SkImageFilter.h"
12 #include "SkPoint.h" 12 #include "SkPoint.h"
13 13
14 class SK_API SkOffsetImageFilter : public SkImageFilter { 14 class SK_API SkOffsetImageFilter : public SkImageFilter {
15 public: 15 public:
16 static SkImageFilter* Create(SkScalar dx, SkScalar dy, SkImageFilter* input = NULL, 16 static sk_sp<SkImageFilter> Make(SkScalar dx, SkScalar dy,
17 const CropRect* cropRect = NULL) { 17 sk_sp<SkImageFilter> input,
18 const CropRect* cropRect = nullptr) {
18 if (!SkScalarIsFinite(dx) || !SkScalarIsFinite(dy)) { 19 if (!SkScalarIsFinite(dx) || !SkScalarIsFinite(dy)) {
19 return NULL; 20 return nullptr;
20 } 21 }
21 return new SkOffsetImageFilter(dx, dy, input, cropRect); 22
23 return sk_sp<SkImageFilter>(new SkOffsetImageFilter(dx, dy, std::move(in put), cropRect));
22 } 24 }
23 25
24 SkRect computeFastBounds(const SkRect& src) const override; 26 SkRect computeFastBounds(const SkRect& src) const override;
25 27
26 SK_TO_STRING_OVERRIDE() 28 SK_TO_STRING_OVERRIDE()
27 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkOffsetImageFilter) 29 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkOffsetImageFilter)
28 30
31 #ifdef SK_SUPPORT_LEGACY_IMAGEFILTER_PTR
32 static SkImageFilter* Create(SkScalar dx, SkScalar dy, SkImageFilter* input = nullptr,
33 const CropRect* cropRect = nullptr) {
34 return Make(dx, dy, sk_ref_sp(input), cropRect).release();
35 }
36 #endif
37
29 protected: 38 protected:
30 void flatten(SkWriteBuffer&) const override; 39 void flatten(SkWriteBuffer&) const override;
31 sk_sp<SkSpecialImage> onFilterImage(SkSpecialImage* source, const Context&, 40 sk_sp<SkSpecialImage> onFilterImage(SkSpecialImage* source, const Context&,
32 SkIPoint* offset) const override; 41 SkIPoint* offset) const override;
33 SkIRect onFilterNodeBounds(const SkIRect&, const SkMatrix&, MapDirection) co nst override; 42 SkIRect onFilterNodeBounds(const SkIRect&, const SkMatrix&, MapDirection) co nst override;
34 43
35 private: 44 private:
36 SkOffsetImageFilter(SkScalar dx, SkScalar dy, SkImageFilter* input, const Cr opRect*); 45 SkOffsetImageFilter(SkScalar dx, SkScalar dy, sk_sp<SkImageFilter> input, co nst CropRect*);
37 46
38 SkVector fOffset; 47 SkVector fOffset;
39 48
40 typedef SkImageFilter INHERITED; 49 typedef SkImageFilter INHERITED;
41 }; 50 };
42 51
43 #endif 52 #endif
OLDNEW
« no previous file with comments | « gm/xfermodeimagefilter.cpp ('k') | samplecode/SampleFilterFuzz.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698