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

Side by Side Diff: include/core/SkImageFilter.h

Issue 1915943002: simplify handle-affine: subclass overrides just describe their leaf behavior (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: early out if onCanHandleComplexCTM returns false 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 | « no previous file | include/effects/SkColorFilterImageFilter.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 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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 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 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. 221 * and all of its (non-null) inputs can handle these more complex matrices.
222 */ 222 */
223 bool canHandleAffine() const { return this->onCanHandleAffine(); } 223 bool canHandleComplexCTM() const;
224 224
225 /** 225 /**
226 * Return an imagefilter which transforms its input by the given matrix. 226 * Return an imagefilter which transforms its input by the given matrix.
227 */ 227 */
228 static sk_sp<SkImageFilter> MakeMatrixFilter(const SkMatrix& matrix, 228 static sk_sp<SkImageFilter> MakeMatrixFilter(const SkMatrix& matrix,
229 SkFilterQuality quality, 229 SkFilterQuality quality,
230 sk_sp<SkImageFilter> input); 230 sk_sp<SkImageFilter> input);
231 231
232 #ifdef SK_SUPPORT_LEGACY_IMAGEFILTER_PTR 232 #ifdef SK_SUPPORT_LEGACY_IMAGEFILTER_PTR
233 static SkImageFilter* CreateMatrixFilter(const SkMatrix& matrix, 233 static SkImageFilter* CreateMatrixFilter(const SkMatrix& matrix,
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 SkIPoint* offset) const; 342 SkIPoint* offset) const;
343 343
344 /** 344 /**
345 * 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
346 * colorfilter w/o CropRect constraints. 346 * colorfilter w/o CropRect constraints.
347 */ 347 */
348 virtual bool onIsColorFilterNode(SkColorFilter** /*filterPtr*/) const { 348 virtual bool onIsColorFilterNode(SkColorFilter** /*filterPtr*/) const {
349 return false; 349 return false;
350 } 350 }
351 351
352 virtual bool onCanHandleAffine() const; 352 /**
353 * Override this to describe the behavior of your subclass - as a leaf node . The caller will
354 * take care of calling your inputs (and return false if any of them could not handle it).
355 */
356 virtual bool onCanHandleComplexCTM() const { return false; }
353 357
354 /** Given a "srcBounds" rect, computes destination bounds for this filter. 358 /** Given a "srcBounds" rect, computes destination bounds for this filter.
355 * "dstBounds" are computed by transforming the crop rect by the context's 359 * "dstBounds" are computed by transforming the crop rect by the context's
356 * CTM, applying it to the initial bounds, and intersecting the result with 360 * CTM, applying it to the initial bounds, and intersecting the result with
357 * the context's clip bounds. "srcBounds" (if non-null) are computed by 361 * the context's clip bounds. "srcBounds" (if non-null) are computed by
358 * intersecting the initial bounds with "dstBounds", to ensure that we neve r 362 * intersecting the initial bounds with "dstBounds", to ensure that we neve r
359 * sample outside of the crop rect (this restriction may be relaxed in the 363 * sample outside of the crop rect (this restriction may be relaxed in the
360 * future). 364 * future).
361 */ 365 */
362 bool applyCropRect(const Context&, const SkIRect& srcBounds, SkIRect* dstBou nds) const; 366 bool applyCropRect(const Context&, const SkIRect& srcBounds, SkIRect* dstBou nds) const;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 */ 409 */
406 #define SK_IMAGEFILTER_UNFLATTEN_COMMON(localVar, expectedCount) \ 410 #define SK_IMAGEFILTER_UNFLATTEN_COMMON(localVar, expectedCount) \
407 Common localVar; \ 411 Common localVar; \
408 do { \ 412 do { \
409 if (!localVar.unflatten(buffer, expectedCount)) { \ 413 if (!localVar.unflatten(buffer, expectedCount)) { \
410 return NULL; \ 414 return NULL; \
411 } \ 415 } \
412 } while (0) 416 } while (0)
413 417
414 #endif 418 #endif
OLDNEW
« no previous file with comments | « no previous file | include/effects/SkColorFilterImageFilter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698