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

Issue 112803004: Make SkImageFilter crop rects relative to the primitive origin, instead of relative to their parent (Closed)

Created:
7 years ago by Stephen White
Modified:
6 years, 11 months ago
Reviewers:
reed1
CC:
skia-review_googlegroups.com
Visibility:
Public.

Description

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 Committed: https://code.google.com/p/skia/source/detail?r=12895

Patch Set 1 #

Patch Set 2 : Apply to remaining filters #

Patch Set 3 : fix offset GM; fix tile GM #

Patch Set 4 : Since offset is an outparam, use =, not +=. #

Patch Set 5 : Add imagefiltersgraph to the ignored list #

Patch Set 6 : Remove a useless zero. #

Total comments: 3

Patch Set 7 : Update docs; initialize offset when returning true from a filter. #

Patch Set 8 : Initialize more offsets. #

Patch Set 9 : Add a unit test. #

Patch Set 10 : Tweak includes #

Patch Set 11 : Fix errors exposed by unit test #

Patch Set 12 : Windows warning fixes #

Patch Set 13 : Updated to ToT #

Unified diffs Side-by-side diffs Delta from patch set Stats (+260 lines, -109 lines) Patch
M expectations/gm/ignored-tests.txt View 1 2 3 4 1 chunk +3 lines, -0 lines 0 comments Download
M gm/imagefiltersgraph.cpp View 1 chunk +19 lines, -0 lines 0 comments Download
M gm/offsetimagefilter.cpp View 1 2 3 4 2 chunks +5 lines, -4 lines 0 comments Download
M gm/tileimagefilter.cpp View 1 2 3 4 5 6 7 8 9 10 11 3 chunks +7 lines, -14 lines 0 comments Download
M include/core/SkImageFilter.h View 1 2 3 4 5 6 2 chunks +17 lines, -2 lines 0 comments Download
M src/core/SkCanvas.cpp View 1 2 chunks +7 lines, -4 lines 0 comments Download
M src/core/SkImageFilter.cpp View 1 chunk +4 lines, -4 lines 0 comments Download
M src/core/SkImageFilterUtils.cpp View 1 2 3 4 5 6 1 chunk +1 line, -0 lines 0 comments Download
M src/effects/SkBicubicImageFilter.cpp View 1 2 3 3 chunks +6 lines, -2 lines 0 comments Download
M src/effects/SkBitmapSource.cpp View 1 2 3 4 5 6 7 2 chunks +3 lines, -2 lines 0 comments Download
M src/effects/SkBlurImageFilter.cpp View 1 2 3 4 5 6 7 8 9 10 6 chunks +10 lines, -5 lines 0 comments Download
M src/effects/SkColorFilterImageFilter.cpp View 1 2 3 2 chunks +7 lines, -5 lines 0 comments Download
M src/effects/SkComposeImageFilter.cpp View 2 chunks +4 lines, -4 lines 0 comments Download
M src/effects/SkDisplacementMapEffect.cpp View 1 2 3 2 chunks +4 lines, -4 lines 0 comments Download
M src/effects/SkDropShadowImageFilter.cpp View 1 2 3 2 chunks +6 lines, -4 lines 0 comments Download
M src/effects/SkLightingImageFilter.cpp View 1 2 3 4 5 6 7 8 9 10 8 chunks +12 lines, -6 lines 0 comments Download
M src/effects/SkMatrixConvolutionImageFilter.cpp View 1 2 3 4 5 6 7 8 9 10 4 chunks +7 lines, -4 lines 0 comments Download
M src/effects/SkMergeImageFilter.cpp View 1 2 3 2 chunks +3 lines, -3 lines 0 comments Download
M src/effects/SkMorphologyImageFilter.cpp View 1 2 3 4 5 6 7 8 9 10 12 chunks +24 lines, -18 lines 0 comments Download
M src/effects/SkOffsetImageFilter.cpp View 1 2 3 2 chunks +11 lines, -8 lines 0 comments Download
M src/effects/SkPictureImageFilter.cpp View 1 2 3 4 5 6 7 3 chunks +4 lines, -2 lines 0 comments Download
M src/effects/SkRectShaderImageFilter.cpp View 1 2 3 1 chunk +2 lines, -2 lines 0 comments Download
M src/effects/SkTileImageFilter.cpp View 1 2 3 4 5 6 7 8 9 10 11 3 chunks +16 lines, -5 lines 0 comments Download
M src/effects/SkXfermodeImageFilter.cpp View 1 2 3 2 chunks +4 lines, -4 lines 0 comments Download
M src/gpu/SkGpuDevice.cpp View 3 chunks +5 lines, -3 lines 0 comments Download
M tests/ImageFilterTest.cpp View 1 2 3 4 5 6 7 8 9 2 chunks +69 lines, -0 lines 0 comments Download

Messages

Total messages: 8 (0 generated)
Stephen White
reed@: PTAL. Thanks!
6 years, 11 months ago (2014-01-03 16:26:04 UTC) #1
reed1
perhaps we could add some dox to onFilterImage now, esp. to clarify this parameter. https://codereview.chromium.org/112803004/diff/260001/src/core/SkCanvas.cpp ...
6 years, 11 months ago (2014-01-03 16:42:07 UTC) #2
Stephen White
Thanks for your review; will modify the docs. https://codereview.chromium.org/112803004/diff/260001/src/core/SkCanvas.cpp File src/core/SkCanvas.cpp (right): https://codereview.chromium.org/112803004/diff/260001/src/core/SkCanvas.cpp#newcode1001 src/core/SkCanvas.cpp:1001: SkIPoint ...
6 years, 11 months ago (2014-01-03 16:48:35 UTC) #3
Stephen White
New patch up: fixed docs; tried to find all the places where a filter returns ...
6 years, 11 months ago (2014-01-03 17:15:04 UTC) #4
reed1
lgtm
6 years, 11 months ago (2014-01-03 17:47:11 UTC) #5
Stephen White
I've added a new unit test to exercise all the filters using a cropped input, ...
6 years, 11 months ago (2014-01-03 19:26:40 UTC) #6
reed1
it still feels weird to me, that you always init an output-only param. I wonder ...
6 years, 11 months ago (2014-01-03 20:05:27 UTC) #7
Stephen White
6 years, 11 months ago (2014-01-03 21:48:29 UTC) #8
Message was sent while issue was closed.
Committed patchset #13 manually as r12895 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698