skia2/modules/svg/include
Tyler Denniston a22d21e447 [svg] Fix incorrect optimization for opacity layer
When both filter and opacity attributes are set on a leaf node, the
opacity must be applied as a separate layer so that the results of the
filter are modified by the opacity. Previously in this circumstance we
were incorrectly applying the opacity to the paints only (without a
layer).

To illustrate:

<svg viewBox="0 0 1000 500" version="1.1"
     xmlns="http://www.w3.org/2000/svg"
     xmlns:xlink="http://www.w3.org/1999/xlink">
  <defs>
    <filter id="Green" x="0%" y="0%" width="100%" height="100%">
      <feFlood flood-color="lime" flood-opacity="1" />
    </filter>
  </defs>
  <rect x="30" y="20" width="400" height="100" fill="red" opacity="0.1"
        filter="url(#Green)"/>
  <g filter="url(#Green)">
    <rect x="30" y="200" width="400" height="100" fill="red" opacity="0.1"/>
  </g>
</svg>

The two rects should render differently. In the <g> case, the filter
output (opaque green) overrides the translucent red pixels of the rect.
In the <rect> case, the filter output overrides the translucent red
pixels with opaque green, but then is modified by the opacity on the
<rect>.

Relevant W3C test is filters-blend-01-b (and possibly others).

Change-Id: I165eed36c546f1f99457865cee58ee2b3bffe6f1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/354879
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Tyler Denniston <tdenniston@google.com>
2021-01-15 18:55:16 +00:00
..
SkSVGAttribute.h [svg] Add support for mask color-interpolation 2021-01-15 15:19:40 +00:00
SkSVGAttributeParser.h [svg] Text rotate support 2021-01-05 17:43:51 +00:00
SkSVGCircle.h [svg] Implement onObjectBoundingBox for circle and path 2021-01-12 15:05:16 +00:00
SkSVGClipPath.h [svg] Add clipPathUnits support 2021-01-14 20:18:15 +00:00
SkSVGContainer.h [svg] Minor cleanups 2020-12-11 16:25:20 +00:00
SkSVGDefs.h Reland "[svg] Relocate out of experimental" 2020-10-16 02:32:41 +00:00
SkSVGDOM.h [svg] Allow clients to pass a custom SkFontMgr 2020-11-11 01:51:44 +00:00
SkSVGEllipse.h [svg] Minor cleanups 2020-12-11 16:25:20 +00:00
SkSVGFe.h [svg] Implement feOffset filter 2021-01-15 15:04:30 +00:00
SkSVGFeColorMatrix.h [svg] Prep work for filter primitive subregion 2020-12-11 18:21:21 +00:00
SkSVGFeComposite.h [svg] Prep work for filter primitive subregion 2020-12-11 18:21:21 +00:00
SkSVGFeFlood.h [svg] Prep work for filter primitive subregion 2020-12-11 18:21:21 +00:00
SkSVGFeGaussianBlur.h [svg] Implement feGaussianBlur 2021-01-12 16:26:16 +00:00
SkSVGFeOffset.h [svg] Implement feOffset filter 2021-01-15 15:04:30 +00:00
SkSVGFeTurbulence.h [svg] Prep work for filter primitive subregion 2020-12-11 18:21:21 +00:00
SkSVGFilter.h [svg] Mask support 2021-01-14 18:50:46 +00:00
SkSVGFilterContext.h Reland "[svg] Perform colorspace conversions for filter effects" 2021-01-14 15:02:23 +00:00
SkSVGG.h Reland "[svg] Relocate out of experimental" 2020-10-16 02:32:41 +00:00
SkSVGGradient.h [svg] Minor cleanups 2020-12-11 16:25:20 +00:00
SkSVGHiddenContainer.h Reland "[svg] Relocate out of experimental" 2020-10-16 02:32:41 +00:00
SkSVGIDMapper.h Reland "[svg] Relocate out of experimental" 2020-10-16 02:32:41 +00:00
SkSVGLine.h [svg] Minor cleanups 2020-12-11 16:25:20 +00:00
SkSVGLinearGradient.h [svg] Minor cleanups 2020-12-11 16:25:20 +00:00
SkSVGMask.h [svg] Mask support 2021-01-14 18:50:46 +00:00
SkSVGNode.h [svg] Add support for mask color-interpolation 2021-01-15 15:19:40 +00:00
SkSVGPath.h [svg] Implement onObjectBoundingBox for circle and path 2021-01-12 15:05:16 +00:00
SkSVGPattern.h [svg] Minor cleanups 2020-12-11 16:25:20 +00:00
SkSVGPoly.h [svg] Fix filter region bounds 2020-12-15 16:15:19 +00:00
SkSVGRadialGradient.h [svg] Minor cleanups 2020-12-11 16:25:20 +00:00
SkSVGRect.h [svg] Minor cleanups 2020-12-11 16:25:20 +00:00
SkSVGRenderContext.h [svg] Fix incorrect optimization for opacity layer 2021-01-15 18:55:16 +00:00
SkSVGShape.h [svg] Minor cleanups 2020-12-11 16:25:20 +00:00
SkSVGStop.h [svg] Minor cleanups 2020-12-11 16:25:20 +00:00
SkSVGSVG.h [svg] Minor cleanups 2020-12-11 16:25:20 +00:00
SkSVGText.h [svg] TextPath support 2021-01-13 14:37:39 +00:00
SkSVGTransformableNode.h [svg] Minor cleanups 2020-12-11 16:25:20 +00:00
SkSVGTypes.h [svg] Add plumbing for color-interpolation-filters property 2021-01-13 18:07:14 +00:00
SkSVGUse.h [svg] Fix <use> bounds calculation 2021-01-14 21:35:58 +00:00
SkSVGValue.h [svg] Initial mask plumbing 2021-01-13 17:23:24 +00:00