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

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

Issue 1884253004: Revert of Update DisplacementMapEffect to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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() override; 23 ~SkDisplacementMapEffect();
24 24
25 static sk_sp<SkImageFilter> Make(ChannelSelectorType xChannelSelector, 25 static SkImageFilter* Create(ChannelSelectorType xChannelSelector,
26 ChannelSelectorType yChannelSelector, 26 ChannelSelectorType yChannelSelector,
27 SkScalar scale, 27 SkScalar scale, SkImageFilter* displacement,
28 sk_sp<SkImageFilter> displacement, 28 SkImageFilter* color = NULL,
29 sk_sp<SkImageFilter> color, 29 const CropRect* cropRect = NULL);
30 const CropRect* cropRect = nullptr);
31 30
32 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDisplacementMapEffect) 31 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDisplacementMapEffect)
33 32
34 SkRect computeFastBounds(const SkRect& src) const override; 33 SkRect computeFastBounds(const SkRect& src) const override;
35 34
36 virtual SkIRect onFilterBounds(const SkIRect& src, const SkMatrix&, 35 virtual SkIRect onFilterBounds(const SkIRect& src, const SkMatrix&,
37 MapDirection) const override; 36 MapDirection) const override;
38 SkIRect onFilterNodeBounds(const SkIRect&, const SkMatrix&, MapDirection) co nst override; 37 SkIRect onFilterNodeBounds(const SkIRect&, const SkMatrix&, MapDirection) co nst override;
39 38
40 SK_TO_STRING_OVERRIDE() 39 SK_TO_STRING_OVERRIDE()
41 40
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
55 protected: 41 protected:
56 sk_sp<SkSpecialImage> onFilterImage(SkSpecialImage* source, const Context&, 42 sk_sp<SkSpecialImage> onFilterImage(SkSpecialImage* source, const Context&,
57 SkIPoint* offset) const override; 43 SkIPoint* offset) const override;
58 44
59 SkDisplacementMapEffect(ChannelSelectorType xChannelSelector, 45 SkDisplacementMapEffect(ChannelSelectorType xChannelSelector,
60 ChannelSelectorType yChannelSelector, 46 ChannelSelectorType yChannelSelector,
61 SkScalar scale, sk_sp<SkImageFilter> inputs[2], 47 SkScalar scale, SkImageFilter* inputs[2],
62 const CropRect* cropRect); 48 const CropRect* cropRect);
63 void flatten(SkWriteBuffer&) const override; 49 void flatten(SkWriteBuffer&) const override;
64 50
65 private: 51 private:
66 ChannelSelectorType fXChannelSelector; 52 ChannelSelectorType fXChannelSelector;
67 ChannelSelectorType fYChannelSelector; 53 ChannelSelectorType fYChannelSelector;
68 SkScalar fScale; 54 SkScalar fScale;
69 typedef SkImageFilter INHERITED; 55 typedef SkImageFilter INHERITED;
70 const SkImageFilter* getDisplacementInput() const { return getInput(0); } 56 const SkImageFilter* getDisplacementInput() const { return getInput(0); }
71 const SkImageFilter* getColorInput() const { return getInput(1); } 57 const SkImageFilter* getColorInput() const { return getInput(1); }
72 }; 58 };
73 59
74 #endif 60 #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