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