Commit 528e002
committed
Regression(251234@main): [Cairo][GTK][WPE] Darker output of SVG with filters fediffuselighting
https://bugs.webkit.org/show_bug.cgi?id=268537
Reviewed by Said Abou-Hallawa and Nikolas Zimmermann.
Turn off the support for linearRGB color space in case of Cairo (251234@main) causes, that SVG
with filter, where linearRGB as inputs is demanded, generates darker output.
The SVG spec says that SourceGraphic has to be in linearRGB color space:
https://www.w3.org/TR/filter-effects-1/#attr-valuedef-in-sourcegraphic
In case of Cairo (which operates in SRGB color space) the image source (SourceGraphic)
should be created in SRGB and before passing it to filters, it should be transformed to
linearRGB color space.
* LayoutTests/TestExpectations:
* LayoutTests/platform/glib/TestExpectations:
Remove some tests which pass with this change
* LayoutTests/svg/filters/feConvolveMatrix-clipped.svg:
* LayoutTests/svg/filters/feGaussianBlur-clipped.svg:
* LayoutTests/fast/gradients/conic-gradient-extended-stops.html:
Add possible differences in outputs
* Source/WebCore/platform/graphics/ImageBuffer.cpp:
(WebCore::ImageBuffer::filteredNativeImage):
Pass color space to endDrawSourceImage
* Source/WebCore/platform/graphics/filters/FEDropShadow.h:
Force to use SRGB as operating color space for DropShadow in case of Cairo.
* Source/WebCore/platform/graphics/filters/FilterImageTargetSwitcher.cpp:
(WebCore::FilterImageTargetSwitcher::endClipAndDrawSourceImage):
(WebCore::FilterImageTargetSwitcher::endDrawSourceImage):
Before applying all filter, the source image has to be translated to requested
color space (only valid for Cairo).
* Source/WebCore/platform/graphics/filters/FilterTargetSwitcher.h:
* Source/WebCore/platform/graphics/filters/FilterImageTargetSwitcher.h:
* Source/WebCore/platform/graphics/filters/FilterStyleTargetSwitcher.h:
Added color space as additional parameter.
* Source/WebCore/platform/graphics/filters/FilterStyleTargetSwitcher.cpp:
(WebCore::FilterStyleTargetSwitcher::endDrawSourceImage):
WebCore::FilterStyleTargetSwitcher::endDrawSourceImage does not use color space so just ignore it
* Source/WebCore/rendering/RenderLayerFilters.cpp:
(WebCore::RenderLayerFilters::applyFilterEffect):
Just pass DestinationColorSpace::SRGB() to endClipAndDrawSourceImage.
* Source/WebCore/rendering/svg/legacy/LegacyRenderSVGResourceFilter.cpp:
(WebCore::LegacyRenderSVGResourceFilter::applyResource):
In case of Cairo, the sourceImage has to be created with sRGB color space, because
Cairo operates in sRGB. The linearRGB color space will be passed to TargetSwitcher
in WebCore::LegacyRenderSVGResourceFilter::postApplyResource and the sourceImage will
be transformed to linearRGB before all filter applying.
(WebCore::LegacyRenderSVGResourceFilter::postApplyResource):
Before applying all filter, the source image has to be translated to requested
color space.
* Source/WebCore/svg/graphics/filters/SVGFilter.cpp:
(WebCore::buildFilterEffectsGraph):
Create SourceGraphic and SourceAlpha with LinearRGB color space if
color-interpolation_filter attribute of the Filter has LinearRGB value (only in case of Cairo).
Canonical link: https://commits.webkit.org/275091@main1 parent 7c28049 commit 528e002
10 files changed
Lines changed: 26 additions & 14 deletions
File tree
- LayoutTests
- fast/gradients
- platform/glib
- svg/filters
- Source
- WTF/wtf
- WebCore
- platform/graphics/filters
- rendering/svg
- svg/graphics/filters
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2651 | 2651 | | |
2652 | 2652 | | |
2653 | 2653 | | |
2654 | | - | |
2655 | | - | |
2656 | 2654 | | |
2657 | 2655 | | |
2658 | 2656 | | |
2659 | 2657 | | |
2660 | 2658 | | |
2661 | | - | |
2662 | | - | |
2663 | 2659 | | |
2664 | 2660 | | |
2665 | 2661 | | |
| |||
Loading
Loading
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
245 | 245 | | |
246 | 246 | | |
247 | 247 | | |
248 | | - | |
| 248 | + | |
249 | 249 | | |
250 | 250 | | |
251 | 251 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
54 | 58 | | |
55 | 59 | | |
56 | 60 | | |
| |||
Lines changed: 4 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
35 | 35 | | |
36 | | - | |
| 36 | + | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
| 39 | + | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
42 | 43 | | |
43 | 44 | | |
44 | 45 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
| 35 | + | |
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
143 | | - | |
144 | | - | |
145 | | - | |
| 143 | + | |
146 | 144 | | |
| 145 | + | |
| 146 | + | |
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
| |||
203 | 203 | | |
204 | 204 | | |
205 | 205 | | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
206 | 213 | | |
207 | 214 | | |
208 | 215 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | | - | |
| 81 | + | |
| 82 | + | |
82 | 83 | | |
83 | 84 | | |
84 | 85 | | |
| |||
0 commit comments