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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
209 */ | 209 */ |
210 sk_sp<SkImageFilter> makeWithLocalMatrix(const SkMatrix&) const; | 210 sk_sp<SkImageFilter> makeWithLocalMatrix(const SkMatrix&) const; |
211 | 211 |
212 #ifdef SK_SUPPORT_LEGACY_IMAGEFILTER_PTR | 212 #ifdef SK_SUPPORT_LEGACY_IMAGEFILTER_PTR |
213 SkImageFilter* newWithLocalMatrix(const SkMatrix& matrix) const { | 213 SkImageFilter* newWithLocalMatrix(const SkMatrix& matrix) const { |
214 return this->makeWithLocalMatrix(matrix).release(); | 214 return this->makeWithLocalMatrix(matrix).release(); |
215 } | 215 } |
216 #endif | 216 #endif |
217 | 217 |
218 /** | 218 /** |
219 * ImageFilters can natively handle scaling and translate components in the CTM. Only some of | |
220 * them can handle affine (or more complex) matrices. This call returns tru e iff the filter | |
221 * and all of its (non-null) inputs can handle these more complex matrices. | |
222 */ | |
223 bool canHandleAffine() const { return this->onCanHandleAffine(); } | |
Stephen White
2016/04/25 14:09:34
<bikeshed> Could we add a noun to that? canHandleA
| |
224 | |
225 /** | |
219 * Return an imagefilter which transforms its input by the given matrix. | 226 * Return an imagefilter which transforms its input by the given matrix. |
220 */ | 227 */ |
221 static sk_sp<SkImageFilter> MakeMatrixFilter(const SkMatrix& matrix, | 228 static sk_sp<SkImageFilter> MakeMatrixFilter(const SkMatrix& matrix, |
222 SkFilterQuality quality, | 229 SkFilterQuality quality, |
223 sk_sp<SkImageFilter> input); | 230 sk_sp<SkImageFilter> input); |
224 | 231 |
225 #ifdef SK_SUPPORT_LEGACY_IMAGEFILTER_PTR | 232 #ifdef SK_SUPPORT_LEGACY_IMAGEFILTER_PTR |
226 static SkImageFilter* CreateMatrixFilter(const SkMatrix& matrix, | 233 static SkImageFilter* CreateMatrixFilter(const SkMatrix& matrix, |
227 SkFilterQuality filterQuality, | 234 SkFilterQuality filterQuality, |
228 SkImageFilter* input = nullptr) { | 235 SkImageFilter* input = nullptr) { |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
335 SkIPoint* offset) const; | 342 SkIPoint* offset) const; |
336 | 343 |
337 /** | 344 /** |
338 * Return true (and return a ref'd colorfilter) if this node in the DAG is just a | 345 * Return true (and return a ref'd colorfilter) if this node in the DAG is just a |
339 * colorfilter w/o CropRect constraints. | 346 * colorfilter w/o CropRect constraints. |
340 */ | 347 */ |
341 virtual bool onIsColorFilterNode(SkColorFilter** /*filterPtr*/) const { | 348 virtual bool onIsColorFilterNode(SkColorFilter** /*filterPtr*/) const { |
342 return false; | 349 return false; |
343 } | 350 } |
344 | 351 |
352 virtual bool onCanHandleAffine() const; | |
353 | |
345 /** Given a "srcBounds" rect, computes destination bounds for this filter. | 354 /** Given a "srcBounds" rect, computes destination bounds for this filter. |
346 * "dstBounds" are computed by transforming the crop rect by the context's | 355 * "dstBounds" are computed by transforming the crop rect by the context's |
347 * CTM, applying it to the initial bounds, and intersecting the result with | 356 * CTM, applying it to the initial bounds, and intersecting the result with |
348 * the context's clip bounds. "srcBounds" (if non-null) are computed by | 357 * the context's clip bounds. "srcBounds" (if non-null) are computed by |
349 * intersecting the initial bounds with "dstBounds", to ensure that we neve r | 358 * intersecting the initial bounds with "dstBounds", to ensure that we neve r |
350 * sample outside of the crop rect (this restriction may be relaxed in the | 359 * sample outside of the crop rect (this restriction may be relaxed in the |
351 * future). | 360 * future). |
352 */ | 361 */ |
353 bool applyCropRect(const Context&, const SkIRect& srcBounds, SkIRect* dstBou nds) const; | 362 bool applyCropRect(const Context&, const SkIRect& srcBounds, SkIRect* dstBou nds) const; |
354 | 363 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
396 */ | 405 */ |
397 #define SK_IMAGEFILTER_UNFLATTEN_COMMON(localVar, expectedCount) \ | 406 #define SK_IMAGEFILTER_UNFLATTEN_COMMON(localVar, expectedCount) \ |
398 Common localVar; \ | 407 Common localVar; \ |
399 do { \ | 408 do { \ |
400 if (!localVar.unflatten(buffer, expectedCount)) { \ | 409 if (!localVar.unflatten(buffer, expectedCount)) { \ |
401 return NULL; \ | 410 return NULL; \ |
402 } \ | 411 } \ |
403 } while (0) | 412 } while (0) |
404 | 413 |
405 #endif | 414 #endif |
OLD | NEW |