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

Issue 211103006: Implement a generic matrix transform image filter. (Closed)

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

Description

Implement a generic matrix transform image filter. This will be used in Blink to accommodate matrices that contain rotation or shearing. This is a generalization of SkResizeImageFilter, so I've replaced all uses of SkResizeImageFilter in Skia. (It might be easier to review by diffing it with SkResizeImageFilter, too.) R=reed@google.com Committed: https://code.google.com/p/skia/source/detail?r=13941

Patch Set 1 #

Patch Set 2 : Fix comment #

Patch Set 3 : Fix 100-col issues #

Total comments: 1

Patch Set 4 : SkTransformImageFilter -> SkMatrixImageFilter #

Patch Set 5 : Rename the GM too #

Unified diffs Side-by-side diffs Delta from patch set Stats (+178 lines, -61 lines) Patch
M gm/imagefiltersclipped.cpp View 1 2 3 3 chunks +4 lines, -2 lines 0 comments Download
M gm/imagefiltersscaled.cpp View 1 2 3 3 chunks +4 lines, -2 lines 0 comments Download
M gm/imageresizetiled.cpp View 1 2 3 2 chunks +4 lines, -2 lines 0 comments Download
A gm/matriximagefilter.cpp View 1 2 3 4 1 chunk +97 lines, -0 lines 0 comments Download
M gm/resizeimagefilter.cpp View 1 2 3 2 chunks +5 lines, -5 lines 0 comments Download
M gyp/effects.gypi View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
M gyp/gmslides.gypi View 1 2 3 4 1 chunk +1 line, -0 lines 0 comments Download
A + include/effects/SkMatrixImageFilter.h View 1 2 3 2 chunks +21 lines, -26 lines 0 comments Download
A + src/effects/SkMatrixImageFilter.cpp View 1 2 3 5 chunks +37 lines, -24 lines 0 comments Download
M src/ports/SkGlobalInitialization_chromium.cpp View 1 2 3 2 chunks +2 lines, -0 lines 0 comments Download
M src/ports/SkGlobalInitialization_default.cpp View 1 2 3 2 chunks +2 lines, -0 lines 0 comments Download

Messages

Total messages: 9 (0 generated)
Stephen White
reed@: PTAL. Thanks!
6 years, 9 months ago (2014-03-25 15:05:14 UTC) #1
reed1
https://codereview.chromium.org/211103006/diff/10012/include/effects/SkTransformImageFilter.h File include/effects/SkTransformImageFilter.h (right): https://codereview.chromium.org/211103006/diff/10012/include/effects/SkTransformImageFilter.h#newcode22 include/effects/SkTransformImageFilter.h:22: class SK_API SkTransformImageFilter : public SkImageFilter { bikeshed: SkMatrixImageFilter ...
6 years, 9 months ago (2014-03-25 16:04:04 UTC) #2
Stephen White
On 2014/03/25 16:04:04, reed1 wrote: > https://codereview.chromium.org/211103006/diff/10012/include/effects/SkTransformImageFilter.h > File include/effects/SkTransformImageFilter.h (right): > > https://codereview.chromium.org/211103006/diff/10012/include/effects/SkTransformImageFilter.h#newcode22 > ...
6 years, 9 months ago (2014-03-25 16:17:24 UTC) #3
Stephen White
On 2014/03/25 16:04:04, reed1 wrote: > https://codereview.chromium.org/211103006/diff/10012/include/effects/SkTransformImageFilter.h > File include/effects/SkTransformImageFilter.h (right): > > https://codereview.chromium.org/211103006/diff/10012/include/effects/SkTransformImageFilter.h#newcode22 > ...
6 years, 9 months ago (2014-03-25 16:45:19 UTC) #4
reed1
lgtm
6 years, 9 months ago (2014-03-25 17:09:32 UTC) #5
Stephen White
Committed patchset #5 manually as r13941 (presubmit successful).
6 years, 9 months ago (2014-03-25 17:35:16 UTC) #6
krit
We had a similar approach in WebKit where we just take scaling into account and ...
6 years, 9 months ago (2014-03-26 06:22:58 UTC) #7
Stephen White
On 2014/03/26 06:22:58, krit wrote: > We had a similar approach in WebKit where we ...
6 years, 9 months ago (2014-03-26 13:13:03 UTC) #8
krit
6 years, 9 months ago (2014-03-26 14:24:29 UTC) #9
Message was sent while issue was closed.
On 2014/03/26 13:13:03, Stephen White wrote:
> On 2014/03/26 06:22:58, krit wrote:
> > We had a similar approach in WebKit where we just take scaling into account
> and
> > applied shearing and rotation later after the filter operation. The main
> problem
> > in WebKit: We just looked up to the root SVG element.We would not recognize
> CTM
> > changes by any root HTML element.
> > 
> > Also, how do you handle 3D transforms? Even if not implemented in SVG, HTML
> can
> > have 3D transforms applied to pretty much every element. Do you take these
> into
> > account? If yes, how?
> 
> No, AFAIK the accumulation of transforms stops at the SVG root.

So the same problem as in WebKit still?

> While Skia
> actually 
> does support perspective matrices, so we could apply them if desired, applying
> them
> post-filter is likely the correct behaviour anyway.

No, filters need to be pixel perfect. That means you need to take care of the
elements own transform as well.

> On the CSS side, if you want
> to 
> blur-then-transform, you apply filter: and transform: to the same element.

Oh, I got you. You mean to get the rotation of the blur filter.

> If
> you want 
> to transform-then-blur, you apply the transform: to a parent element, and
> filter: to the 
> child. So both options are available. In neither case do the transforms
directly
> affect
> the filter parameters.
> 
> I actually find it a bit odd that SVG automatically applies shearing and
> rotation transforms to filters
> at all. But that seems to be the spec behaviour.

There has been request to let filters operate in a predefined coordinate space
or simply the root element space. This would allow you effects of rotating
elements where the shadow stays in the same direction. This will likely be a
theme for the next level of Filter Effects. This is what Flash does and many
game developers rely on.

Powered by Google App Engine
This is Rietveld 408576698