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

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

Issue 1877783003: Update DisplacementMapEffect to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix bug 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/imagefilterstransformed.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 2013 Google Inc. 2 * Copyright 2013 Google Inc.
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 SkDisplacementMapEffect_DEFINED 8 #ifndef SkDisplacementMapEffect_DEFINED
9 #define SkDisplacementMapEffect_DEFINED 9 #define SkDisplacementMapEffect_DEFINED
10 10
11 #include "SkImageFilter.h" 11 #include "SkImageFilter.h"
12 12
13 class SK_API SkDisplacementMapEffect : public SkImageFilter { 13 class SK_API SkDisplacementMapEffect : public SkImageFilter {
14 public: 14 public:
15 enum ChannelSelectorType { 15 enum ChannelSelectorType {
16 kUnknown_ChannelSelectorType, 16 kUnknown_ChannelSelectorType,
17 kR_ChannelSelectorType, 17 kR_ChannelSelectorType,
18 kG_ChannelSelectorType, 18 kG_ChannelSelectorType,
19 kB_ChannelSelectorType, 19 kB_ChannelSelectorType,
20 kA_ChannelSelectorType 20 kA_ChannelSelectorType
21 }; 21 };
22 22
23 ~SkDisplacementMapEffect(); 23 ~SkDisplacementMapEffect() override;
24 24
25 static SkImageFilter* Create(ChannelSelectorType xChannelSelector, 25 static sk_sp<SkImageFilter> Make(ChannelSelectorType xChannelSelector,
26 ChannelSelectorType yChannelSelector, 26 ChannelSelectorType yChannelSelector,
27 SkScalar scale, SkImageFilter* displacement, 27 SkScalar scale,
28 SkImageFilter* color = NULL, 28 sk_sp<SkImageFilter> displacement,
29 const CropRect* cropRect = NULL); 29 sk_sp<SkImageFilter> color,
30 const CropRect* cropRect = nullptr);
30 31
31 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDisplacementMapEffect) 32 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDisplacementMapEffect)
32 33
33 SkRect computeFastBounds(const SkRect& src) const override; 34 SkRect computeFastBounds(const SkRect& src) const override;
34 35
35 virtual SkIRect onFilterBounds(const SkIRect& src, const SkMatrix&, 36 virtual SkIRect onFilterBounds(const SkIRect& src, const SkMatrix&,
36 MapDirection) const override; 37 MapDirection) const override;
37 SkIRect onFilterNodeBounds(const SkIRect&, const SkMatrix&, MapDirection) co nst override; 38 SkIRect onFilterNodeBounds(const SkIRect&, const SkMatrix&, MapDirection) co nst override;
38 39
39 SK_TO_STRING_OVERRIDE() 40 SK_TO_STRING_OVERRIDE()
40 41
42 #ifdef SK_SUPPORT_LEGACY_IMAGEFILTER_PTR
43 static SkImageFilter* Create(ChannelSelectorType xChannelSelector,
44 ChannelSelectorType yChannelSelector,
45 SkScalar scale, SkImageFilter* displacement,
46 SkImageFilter* color = nullptr,
47 const CropRect* cropRect = nullptr) {
48 return Make(xChannelSelector, yChannelSelector, scale,
49 sk_ref_sp<SkImageFilter>(displacement),
50 sk_ref_sp<SkImageFilter>(color),
51 cropRect).release();
52 }
53 #endif
54
41 protected: 55 protected:
42 sk_sp<SkSpecialImage> onFilterImage(SkSpecialImage* source, const Context&, 56 sk_sp<SkSpecialImage> onFilterImage(SkSpecialImage* source, const Context&,
43 SkIPoint* offset) const override; 57 SkIPoint* offset) const override;
44 58
45 SkDisplacementMapEffect(ChannelSelectorType xChannelSelector, 59 SkDisplacementMapEffect(ChannelSelectorType xChannelSelector,
46 ChannelSelectorType yChannelSelector, 60 ChannelSelectorType yChannelSelector,
47 SkScalar scale, SkImageFilter* inputs[2], 61 SkScalar scale, sk_sp<SkImageFilter> inputs[2],
48 const CropRect* cropRect); 62 const CropRect* cropRect);
49 void flatten(SkWriteBuffer&) const override; 63 void flatten(SkWriteBuffer&) const override;
50 64
51 private: 65 private:
52 ChannelSelectorType fXChannelSelector; 66 ChannelSelectorType fXChannelSelector;
53 ChannelSelectorType fYChannelSelector; 67 ChannelSelectorType fYChannelSelector;
54 SkScalar fScale; 68 SkScalar fScale;
55 typedef SkImageFilter INHERITED; 69 typedef SkImageFilter INHERITED;
56 const SkImageFilter* getDisplacementInput() const { return getInput(0); } 70 const SkImageFilter* getDisplacementInput() const { return getInput(0); }
57 const SkImageFilter* getColorInput() const { return getInput(1); } 71 const SkImageFilter* getColorInput() const { return getInput(1); }
58 }; 72 };
59 73
60 #endif 74 #endif
OLDNEW
« no previous file with comments | « gm/imagefilterstransformed.cpp ('k') | samplecode/SampleFilterFuzz.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698