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

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

Issue 1893973002: Outline SkImageFilter Make methods (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 | « include/effects/SkMergeImageFilter.h ('k') | include/effects/SkOffsetImageFilter.h » ('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 SkMorphologyImageFilter_DEFINED 8 #ifndef SkMorphologyImageFilter_DEFINED
9 #define SkMorphologyImageFilter_DEFINED 9 #define SkMorphologyImageFilter_DEFINED
10 10
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 SkISize fRadius; 50 SkISize fRadius;
51 51
52 typedef SkImageFilter INHERITED; 52 typedef SkImageFilter INHERITED;
53 }; 53 };
54 54
55 /////////////////////////////////////////////////////////////////////////////// 55 ///////////////////////////////////////////////////////////////////////////////
56 class SK_API SkDilateImageFilter : public SkMorphologyImageFilter { 56 class SK_API SkDilateImageFilter : public SkMorphologyImageFilter {
57 public: 57 public:
58 static sk_sp<SkImageFilter> Make(int radiusX, int radiusY, 58 static sk_sp<SkImageFilter> Make(int radiusX, int radiusY,
59 sk_sp<SkImageFilter> input, 59 sk_sp<SkImageFilter> input,
60 const CropRect* cropRect = nullptr) { 60 const CropRect* cropRect = nullptr);
61 if (radiusX < 0 || radiusY < 0) {
62 return nullptr;
63 }
64 return sk_sp<SkImageFilter>(new SkDilateImageFilter(radiusX, radiusY,
65 std::move(input),
66 cropRect));
67 }
68 61
69 SK_TO_STRING_OVERRIDE() 62 SK_TO_STRING_OVERRIDE()
70 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDilateImageFilter) 63 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDilateImageFilter)
71 64
72 #ifdef SK_SUPPORT_LEGACY_IMAGEFILTER_PTR 65 #ifdef SK_SUPPORT_LEGACY_IMAGEFILTER_PTR
73 static SkImageFilter* Create(int radiusX, int radiusY, 66 static SkImageFilter* Create(int radiusX, int radiusY,
74 SkImageFilter* input = nullptr, 67 SkImageFilter* input = nullptr,
75 const CropRect* cropRect = nullptr) { 68 const CropRect* cropRect = nullptr) {
76 return Make(radiusX, radiusY, 69 return Make(radiusX, radiusY,
77 sk_ref_sp<SkImageFilter>(input), 70 sk_ref_sp<SkImageFilter>(input),
(...skipping 11 matching lines...) Expand all
89 : INHERITED(radiusX, radiusY, input, cropRect) {} 82 : INHERITED(radiusX, radiusY, input, cropRect) {}
90 83
91 typedef SkMorphologyImageFilter INHERITED; 84 typedef SkMorphologyImageFilter INHERITED;
92 }; 85 };
93 86
94 /////////////////////////////////////////////////////////////////////////////// 87 ///////////////////////////////////////////////////////////////////////////////
95 class SK_API SkErodeImageFilter : public SkMorphologyImageFilter { 88 class SK_API SkErodeImageFilter : public SkMorphologyImageFilter {
96 public: 89 public:
97 static sk_sp<SkImageFilter> Make(int radiusX, int radiusY, 90 static sk_sp<SkImageFilter> Make(int radiusX, int radiusY,
98 sk_sp<SkImageFilter> input, 91 sk_sp<SkImageFilter> input,
99 const CropRect* cropRect = nullptr) { 92 const CropRect* cropRect = nullptr);
100 if (radiusX < 0 || radiusY < 0) {
101 return nullptr;
102 }
103 return sk_sp<SkImageFilter>(new SkErodeImageFilter(radiusX, radiusY,
104 std::move(input),
105 cropRect));
106 }
107 93
108 SK_TO_STRING_OVERRIDE() 94 SK_TO_STRING_OVERRIDE()
109 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkErodeImageFilter) 95 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkErodeImageFilter)
110 96
111 #ifdef SK_SUPPORT_LEGACY_IMAGEFILTER_PTR 97 #ifdef SK_SUPPORT_LEGACY_IMAGEFILTER_PTR
112 static SkImageFilter* Create(int radiusX, int radiusY, 98 static SkImageFilter* Create(int radiusX, int radiusY,
113 SkImageFilter* input = nullptr, 99 SkImageFilter* input = nullptr,
114 const CropRect* cropRect = nullptr) { 100 const CropRect* cropRect = nullptr) {
115 return Make(radiusX, radiusY, 101 return Make(radiusX, radiusY,
116 sk_ref_sp<SkImageFilter>(input), 102 sk_ref_sp<SkImageFilter>(input),
117 cropRect).release(); 103 cropRect).release();
118 } 104 }
119 #endif 105 #endif
120 106
121 protected: 107 protected:
122 Op op() const override { return kErode_Op; } 108 Op op() const override { return kErode_Op; }
123 109
124 private: 110 private:
125 SkErodeImageFilter(int radiusX, int radiusY, 111 SkErodeImageFilter(int radiusX, int radiusY,
126 sk_sp<SkImageFilter> input, const CropRect* cropRect) 112 sk_sp<SkImageFilter> input, const CropRect* cropRect)
127 : INHERITED(radiusX, radiusY, input, cropRect) {} 113 : INHERITED(radiusX, radiusY, input, cropRect) {}
128 114
129 typedef SkMorphologyImageFilter INHERITED; 115 typedef SkMorphologyImageFilter INHERITED;
130 }; 116 };
131 117
132 #endif 118 #endif
OLDNEW
« no previous file with comments | « include/effects/SkMergeImageFilter.h ('k') | include/effects/SkOffsetImageFilter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698