Fix tiled (stitched) FETurbulence.

The legacy implementation of FETurbulence actually never generated
tile-able noise. The algorithmic problem was fixed in Skia
(https://codereview.chromium.org/332523006/), but Blink was also not
passing the tile size (filter primitive subregion) to the turbulence
shader. This change fixes the latter (small) problem.

BUG=383495
R=fmalita

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

git-svn-id: svn://svn.chromium.org/blink/trunk@176121 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 599b1a12
...@@ -1062,6 +1062,8 @@ crbug.com/308768 inspector/network/network-status-non-http.html [ Skip ] ...@@ -1062,6 +1062,8 @@ crbug.com/308768 inspector/network/network-status-non-http.html [ Skip ]
crbug.com/381102 inspector/sources/debugger/debugger-step-into-custom-element-callbacks.html [ Skip ] crbug.com/381102 inspector/sources/debugger/debugger-step-into-custom-element-callbacks.html [ Skip ]
crbug.com/383495 svg/filters/feTurbulence-tiled.svg [ NeedsRebaseline ]
# Started being flaky in r175790. # Started being flaky in r175790.
crbug.com/361045 inspector/layers/tracing-layer-tree.html [ Pass Failure ] crbug.com/361045 inspector/layers/tracing-layer-tree.html [ Pass Failure ]
......
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="svg-root" width="100%" height="100%">
<defs>
<filter id="f1" x="0%" y="0%" width="100%" height="100%">
<feTurbulence type="turbulence" baseFrequency="0.03" x="0" y="0" width="50" height="50" stitchTiles="stitch"/>
<feTile/>
</filter>
</defs>
<rect width="200" height="200" filter="url(#f1)"/>
</svg>
...@@ -401,9 +401,9 @@ void FETurbulence::applySoftware() ...@@ -401,9 +401,9 @@ void FETurbulence::applySoftware()
fillRegion(pixelArray, paintingData, 0, absolutePaintRect().height(), m_baseFrequencyX, m_baseFrequencyY); fillRegion(pixelArray, paintingData, 0, absolutePaintRect().height(), m_baseFrequencyX, m_baseFrequencyY);
} }
SkShader* FETurbulence::createShader(const IntRect& filterRegion) SkShader* FETurbulence::createShader()
{ {
const SkISize size = SkISize::Make(filterRegion.width(), filterRegion.height()); const SkISize size = SkISize::Make(effectBoundaries().width(), effectBoundaries().height());
// Frequency should be scaled by page zoom, but not by primitiveUnits. // Frequency should be scaled by page zoom, but not by primitiveUnits.
// So we apply only the transform scale (as Filter::apply*Scale() do) // So we apply only the transform scale (as Filter::apply*Scale() do)
// and not the target bounding box scale (as SVGFilter::apply*Scale() // and not the target bounding box scale (as SVGFilter::apply*Scale()
...@@ -423,7 +423,7 @@ SkShader* FETurbulence::createShader(const IntRect& filterRegion) ...@@ -423,7 +423,7 @@ SkShader* FETurbulence::createShader(const IntRect& filterRegion)
PassRefPtr<SkImageFilter> FETurbulence::createImageFilter(SkiaImageFilterBuilder* builder) PassRefPtr<SkImageFilter> FETurbulence::createImageFilter(SkiaImageFilterBuilder* builder)
{ {
SkAutoTUnref<SkShader> shader(createShader(IntRect())); SkAutoTUnref<SkShader> shader(createShader());
SkImageFilter::CropRect rect = getCropRect(builder->cropOffset()); SkImageFilter::CropRect rect = getCropRect(builder->cropOffset());
return adoptRef(SkRectShaderImageFilter::Create(shader, &rect)); return adoptRef(SkRectShaderImageFilter::Create(shader, &rect));
} }
......
...@@ -117,7 +117,7 @@ private: ...@@ -117,7 +117,7 @@ private:
virtual void applySoftware() OVERRIDE; virtual void applySoftware() OVERRIDE;
virtual PassRefPtr<SkImageFilter> createImageFilter(SkiaImageFilterBuilder*) OVERRIDE; virtual PassRefPtr<SkImageFilter> createImageFilter(SkiaImageFilterBuilder*) OVERRIDE;
SkShader* createShader(const IntRect& filterRegion); SkShader* createShader();
inline void initPaint(PaintingData&); inline void initPaint(PaintingData&);
float noise2D(int channel, PaintingData&, StitchData&, const FloatPoint&); float noise2D(int channel, PaintingData&, StitchData&, const FloatPoint&);
......
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