OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 SkImageFilter_DEFINED | 8 #ifndef SkImageFilter_DEFINED |
9 #define SkImageFilter_DEFINED | 9 #define SkImageFilter_DEFINED |
10 | 10 |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 */ | 145 */ |
146 bool isColorFilterNode(SkColorFilter** filterPtr) const { | 146 bool isColorFilterNode(SkColorFilter** filterPtr) const { |
147 return this->onIsColorFilterNode(filterPtr); | 147 return this->onIsColorFilterNode(filterPtr); |
148 } | 148 } |
149 | 149 |
150 // DEPRECATED : use isColorFilterNode() instead | 150 // DEPRECATED : use isColorFilterNode() instead |
151 bool asColorFilter(SkColorFilter** filterPtr) const { | 151 bool asColorFilter(SkColorFilter** filterPtr) const { |
152 return this->isColorFilterNode(filterPtr); | 152 return this->isColorFilterNode(filterPtr); |
153 } | 153 } |
154 | 154 |
| 155 static sk_sp<SkImageFilter> MakeBlur(SkScalar sigmaX, SkScalar sigmaY, |
| 156 sk_sp<SkImageFilter> input, |
| 157 const CropRect* cropRect = nullptr); |
| 158 |
155 /** | 159 /** |
156 * Returns true (and optionally returns a ref'd filter) if this imagefilter
can be completely | 160 * Returns true (and optionally returns a ref'd filter) if this imagefilter
can be completely |
157 * replaced by the returned colorfilter. i.e. the two effects will affect d
rawing in the | 161 * replaced by the returned colorfilter. i.e. the two effects will affect d
rawing in the |
158 * same way. | 162 * same way. |
159 */ | 163 */ |
160 bool asAColorFilter(SkColorFilter** filterPtr) const; | 164 bool asAColorFilter(SkColorFilter** filterPtr) const; |
161 | 165 |
162 /** | 166 /** |
163 * Returns the number of inputs this filter will accept (some inputs can | 167 * Returns the number of inputs this filter will accept (some inputs can |
164 * be NULL). | 168 * be NULL). |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 #ifdef SK_SUPPORT_LEGACY_IMAGEFILTER_PTR | 226 #ifdef SK_SUPPORT_LEGACY_IMAGEFILTER_PTR |
223 static SkImageFilter* CreateMatrixFilter(const SkMatrix& matrix, | 227 static SkImageFilter* CreateMatrixFilter(const SkMatrix& matrix, |
224 SkFilterQuality filterQuality, | 228 SkFilterQuality filterQuality, |
225 SkImageFilter* input = nullptr) { | 229 SkImageFilter* input = nullptr) { |
226 return MakeMatrixFilter(matrix, filterQuality, sk_ref_sp<SkImageFilter>(
input)).release(); | 230 return MakeMatrixFilter(matrix, filterQuality, sk_ref_sp<SkImageFilter>(
input)).release(); |
227 } | 231 } |
228 #endif | 232 #endif |
229 | 233 |
230 SK_TO_STRING_PUREVIRT() | 234 SK_TO_STRING_PUREVIRT() |
231 SK_DEFINE_FLATTENABLE_TYPE(SkImageFilter) | 235 SK_DEFINE_FLATTENABLE_TYPE(SkImageFilter) |
| 236 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() |
232 | 237 |
233 protected: | 238 protected: |
234 class Common { | 239 class Common { |
235 public: | 240 public: |
236 /** | 241 /** |
237 * Attempt to unflatten the cropRect and the expected number of input f
ilters. | 242 * Attempt to unflatten the cropRect and the expected number of input f
ilters. |
238 * If any number of input filters is valid, pass -1. | 243 * If any number of input filters is valid, pass -1. |
239 * If this fails (i.e. corrupt buffer or contents) then return false an
d common will | 244 * If this fails (i.e. corrupt buffer or contents) then return false an
d common will |
240 * be left uninitialized. | 245 * be left uninitialized. |
241 * If this returns true, then inputCount() is the number of found input
filters, each | 246 * If this returns true, then inputCount() is the number of found input
filters, each |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 */ | 404 */ |
400 #define SK_IMAGEFILTER_UNFLATTEN_COMMON(localVar, expectedCount) \ | 405 #define SK_IMAGEFILTER_UNFLATTEN_COMMON(localVar, expectedCount) \ |
401 Common localVar; \ | 406 Common localVar; \ |
402 do { \ | 407 do { \ |
403 if (!localVar.unflatten(buffer, expectedCount)) { \ | 408 if (!localVar.unflatten(buffer, expectedCount)) { \ |
404 return NULL; \ | 409 return NULL; \ |
405 } \ | 410 } \ |
406 } while (0) | 411 } while (0) |
407 | 412 |
408 #endif | 413 #endif |
OLD | NEW |