diff options
author | senorblanco@chromium.org <senorblanco@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-01-03 21:48:22 +0000 |
---|---|---|
committer | senorblanco@chromium.org <senorblanco@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-01-03 21:48:22 +0000 |
commit | 6776b82d466fa93ccffd251fdf556fe058395444 (patch) | |
tree | eec73f3d3613a5a9dffd40c8f899c73f283749b0 /include/core | |
parent | 927138977fa256a6719baf74221882555b24008f (diff) |
Make SkImageFilter crop rects relative to the primitive origin, instead of relative to their parent's crop rect. This is required by SVG semantics, and is more sane anyway.
To do this, this patch changes the "offset/loc" parameter in filterImage() / onFilterImage() from an inout-param to an out-param only, so that the calling filter can know how much the input filter wants its result offset (and doesn't include the original primitive position). This offset can then be applied to the current filter's crop rect. (I've renamed the parameter "offset" in all cases to make this clear.) This makes the call sites in SkCanvas/SkGpuDevice responsible for applying the resulting offset to the primitive's position, which is actually a fairly small change.
This change also fixes SkTileImageFilter and SkOffsetImageFilter to correctly handle an input offset, which they weren't before. This required modifying the GM's, since they assumed the broken behaviour.
NOTE: this will require rebaselining the imagefiltersgraph test, since it has a new test case.
NOTE: this will "break" the Blink layout tests css3/filters/effect-reference-subregion-chained-hw.html and css3/filters/effect-reference-subregion-hw.html, but it actually makes them give correct results. It should be suppressed on the skia roll, and I'll rebaseline it.
R=reed@google.com
Review URL: https://codereview.chromium.org/112803004
git-svn-id: http://skia.googlecode.com/svn/trunk@12895 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include/core')
-rw-r--r-- | include/core/SkImageFilter.h | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/include/core/SkImageFilter.h b/include/core/SkImageFilter.h index 4c372a413d..398af90ca0 100644 --- a/include/core/SkImageFilter.h +++ b/include/core/SkImageFilter.h @@ -71,7 +71,7 @@ public: * The matrix is the current matrix on the canvas. * * Offset is the amount to translate the resulting image relative to the - * src when it is drawn. + * src when it is drawn. This is an out-param. * * If the result image cannot be created, return false, in which case both * the result and offset parameters will be ignored by the caller. @@ -167,7 +167,22 @@ protected: virtual void flatten(SkFlattenableWriteBuffer& wb) const SK_OVERRIDE; - // Default impl returns false + /** + * This is the virtual which should be overridden by the derived class + * to perform image filtering. + * + * src is the original primitive bitmap. If the filter has a connected + * input, it should recurse on that input and use that in place of src. + * + * The matrix is the current matrix on the canvas. + * + * Offset is the amount to translate the resulting image relative to the + * src when it is drawn. This is an out-param. + * + * If the result image cannot be created, this should false, in which + * case both the result and offset parameters will be ignored by the + * caller. + */ virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&, SkBitmap* result, SkIPoint* offset); // Default impl copies src into dst and returns true |