diff options
author | senorblanco <senorblanco@chromium.org> | 2015-10-28 14:17:16 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-10-28 14:17:17 -0700 |
commit | 4449398b324a7d6226a71e766561ace0028b5153 (patch) | |
tree | 3b40d0ef63d0ff058e3099dd2bc4d9e7ac0a083f /include/core | |
parent | a3f792d4d4fa344704ca245ef6d702429a202a37 (diff) |
Make SkImageFilter::applyCropRect() optionally compute srcBounds.
BUG=skia:4526
Review URL: https://codereview.chromium.org/1410553007
Diffstat (limited to 'include/core')
-rw-r--r-- | include/core/SkImageFilter.h | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/include/core/SkImageFilter.h b/include/core/SkImageFilter.h index 0c3d4c2ddf..d90df29c8b 100644 --- a/include/core/SkImageFilter.h +++ b/include/core/SkImageFilter.h @@ -368,14 +368,18 @@ protected: return false; } - /** Computes source bounds as the src bitmap bounds offset by srcOffset. - * Apply the transformed crop rect to the bounds if any of the - * corresponding edge flags are set. Intersects the result against the - * context's clipBounds, and returns the result in "bounds". If there is - * no intersection, returns false and leaves "bounds" unchanged. + /** Given a "src" bitmap and its "srcOffset", computes source and + * destination bounds for this filter. Initial bounds are the + * "src" bitmap bounds offset by "srcOffset". "dstBounds" are + * computed by transforming the crop rect by the context's CTM, + * applying it to the initial bounds, and intersecting the result + * with the context's clip bounds. "srcBounds" (if non-null) are + * computed by intersecting the initial bounds with "dstBounds", to + * ensure that we never sample outside of the crop rect (this restriction + * may be relaxed in the future). */ bool applyCropRect(const Context&, const SkBitmap& src, const SkIPoint& srcOffset, - SkIRect* bounds) const; + SkIRect* dstBounds, SkIRect* srcBounds = nullptr) const; /** Same as the above call, except that if the resulting crop rect is not * entirely contained by the source bitmap's bounds, it creates a new |