Open
Bug 1424983
Opened 7 years ago
Updated 2 years ago
[Moz2D] SVG Filter have no effect on the image if HWA is enabled
Categories
(Core :: Graphics, defect, P3)
Tracking
()
NEW
Tracking | Status | |
---|---|---|
firefox-esr52 | --- | wontfix |
firefox57 | --- | wontfix |
firefox58 | --- | wontfix |
firefox59 | --- | fix-optional |
firefox60 | --- | fix-optional |
People
(Reporter: r2drozdz, Unassigned)
References
Details
(Keywords: regression, Whiteboard: [gfx-noted])
Attachments
(1 file)
(deleted),
image/png
|
Details |
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.84 Safari/537.36
Steps to reproduce:
Basically, open this codepen:
https://codepen.io/anon/pen/zpxKdO
It contains a SVG with an image and simple filter applied.
Actual results:
In Firefox the filters have no effect on the image. In other browsers the image looks dramatically different. The cause of this is an optimisation that Firefox makes to its feColorMatrix filters. If they appear consecutively then it concatenates the matrices. But this is incorrect with some matrices that transform the colours outside of the 0 to 1 range which requires clamping of the colours. So in this example the first filter adds half to the red channel of the image (transforming to the range 0.5 to 1.5) and the second channel subtracts half. Clamping means this has the effect of setting R to min(R,0.5). The first filter subtracts half from the green channel (transforming to the range -0.5 to +0.5) and the second filter adds half. Clamping has the effect of setting G to max(G,0.5). The blue channel is slightly more complex. The first filter multiplies the blue channel by 2 and subtracts half (transforming to the range -0.5 to +1.5) and second filter divides by 2 and adds a quarter. Clamping has the effect of setting B to max(0.25,min(B,0.75)).
So when Firefox concatenates these two color matrices, they cancel out leaving no overall effect. Usually this concatenation of matrices is a good optimisation, but not when colours are transformed outside of the 0 to 1 range. I would suggest that Firefox should only concatenate matrices only if the first does not transform the primary colours outside of the 0 to 1 range.
Note that the clamping is very useful. I use feColorMatrix with clamping to determine the minimum and maximum of the R, G and B channels. But unfortunately because of this bug this fails in Firefox and I have no alternative way of achieving the same result using SVG filters.
Does Firefox optimise other SVG filters in the same way?
Expected results:
Filter should be applied on the image like in other browser (see image attached).
Comment 1•7 years ago
|
||
I can reproduce the problem on Nightly59.0a1 Windows10.
Regression window:
https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=6ecf0c4dfcbe&tochange=3c44c1f43a67
Suspect:Bug 924103, Bug 924102
And Disabling HWA fixes the problem.
Status: UNCONFIRMED → NEW
status-firefox57:
--- → affected
status-firefox58:
--- → affected
status-firefox59:
--- → affected
status-firefox-esr52:
--- → affected
Ever confirmed: true
Keywords: regression
Version: 57 Branch → 28 Branch
Updated•7 years ago
|
Component: SVG → Graphics
Updated•7 years ago
|
Summary: SVG Filter have no effect on the image → [Moz2D] SVG Filter have no effect on the image if HWA is enabled
Comment 2•7 years ago
|
||
@:mstange
Your bunch of patch seems to cause the regression. Can you look into this?
Flags: needinfo?(mstange)
Comment 3•7 years ago
|
||
samw underlying cause as bug 1421537 perhaps?
Comment 4•7 years ago
|
||
It might be! It must be Direct2D that's doing the optimization internally, because on the Gecko / Moz2D side we intentionally don't collapse subsequent color matrix filters for exactly this reason.
Updated•7 years ago
|
Priority: -- → P3
Whiteboard: [gfx-noted]
Updated•7 years ago
|
Updated•7 years ago
|
Flags: needinfo?(mstange)
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•