Provide correct saveLayer() bounds in FEGaussianBlur, FEMorphology.

In Skia r13323, I changed Skia's image filter clipping behaviour to
expand clip bounds to accommodate filter margins. However, the legacy
Blink DAG already makes such accommodation, which means we're creating
an offscreen with redundant pixels. The fix is to specify the computed
bounds directly in saveLayer(), which overrides (well, actually
intersects) the clip, giving the correct bounds. This does give
different results for large blur sigmas, but I believe the new results
are spec-correct: the intermediate buffers used by filters should
never exceed the size of the filter region.

Covered by marked svg tests.

BUG=
R=schenney@chromium.org

Review URL: https://codereview.chromium.org/214693008

git-svn-id: svn://svn.chromium.org/blink/trunk@170232 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 8c83dc5d
......@@ -792,8 +792,23 @@ crbug.com/331186 [ Debug ] css3/flexbox/position-absolute-child.html [ Slow ]
crbug.com/346151 css3/filters/effect-reference-hidpi-hw.html [ Pass ImageOnlyFailure ]
crbug.com/333242 svg/dynamic-updates/SVGUseElement-dom-href1-attr.html [ Pass ImageOnlyFailure ]
crbug.com/333242 svg/dynamic-updates/SVGUseElement-svgdom-href1-prop.html [ Pass ImageOnlyFailure ]
Bug(senorblanco) svg/W3C-SVG-1.1/filters-gauss-01-b.svg [ NeedsRebaseline ]
Bug(senorblanco) svg/W3C-SVG-1.1/filters-morph-01-f.svg [ NeedsRebaseline ]
Bug(senorblanco) svg/dynamic-updates/SVGUseElement-dom-href1-attr.html [ NeedsRebaseline ]
Bug(senorblanco) svg/dynamic-updates/SVGUseElement-svgdom-href1-prop.html [ NeedsRebaseline ]
Bug(senorblanco) svg/filters/filterRes.svg [ NeedsRebaseline ]
Bug(senorblanco) svg/dynamic-updates/SVGFEGaussianBlurElement-dom-in-attr.html [ NeedsRebaseline ]
Bug(senorblanco) svg/dynamic-updates/SVGFEGaussianBlurElement-dom-stdDeviation-attr.html [ NeedsRebaseline ]
Bug(senorblanco) svg/dynamic-updates/SVGFEGaussianBlurElement-dom-stdDeviation-call.html [ NeedsRebaseline ]
Bug(senorblanco) svg/dynamic-updates/SVGFEGaussianBlurElement-svgdom-in-prop.html [ NeedsRebaseline ]
Bug(senorblanco) svg/filters/feGaussianBlur.svg [ NeedsRebaseline ]
Bug(senorblanco) svg/filters/shadow-on-filter.svg [ NeedsRebaseline ]
Bug(senorblanco) css3/filters/effect-reference-subregion.html [ NeedsRebaseline ]
Bug(senorblanco) svg/batik/text/textFeatures.svg [ NeedsRebaseline ]
Bug(senorblanco) svg/batik/text/smallFonts.svg [ NeedsRebaseline ]
# crbug.com/333242 svg/dynamic-updates/SVGUseElement-dom-href1-attr.html [ Pass ImageOnlyFailure ]
# crbug.com/333242 svg/dynamic-updates/SVGUseElement-svgdom-href1-prop.html [ Pass ImageOnlyFailure ]
crbug.com/337732 fast/css/fontfaceset-download-error.html [ Pass Timeout ]
crbug.com/337735 [ Linux ] compositing/overflow/iframe-scroll-children.html [ Pass Crash ]
......
......@@ -332,7 +332,8 @@ bool FEGaussianBlur::applySkia()
GraphicsContext* dstContext = resultImage->context();
paint.setImageFilter(new SkBlurImageFilter(stdX, stdY))->unref();
dstContext->saveLayer(0, &paint);
SkRect bounds = SkRect::MakeWH(absolutePaintRect().width(), absolutePaintRect().height());
dstContext->saveLayer(&bounds, &paint);
paint.setColor(0xFFFFFFFF);
dstContext->drawImage(image.get(), drawingRegion.location(), CompositeCopy);
dstContext->restoreLayer();
......
......@@ -244,7 +244,8 @@ bool FEMorphology::applySkia()
else if (m_type == FEMORPHOLOGY_OPERATOR_ERODE)
paint.setImageFilter(new SkErodeImageFilter(radiusX, radiusY))->unref();
dstContext->saveLayer(0, &paint);
SkRect bounds = SkRect::MakeWH(absolutePaintRect().width(), absolutePaintRect().height());
dstContext->saveLayer(&bounds, &paint);
dstContext->drawImage(image.get(), drawingRegion.location(), CompositeCopy);
dstContext->restoreLayer();
return true;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment