Re: [filter-effects] Bug in feTurbulance random algorithm.

On Sun, 04 Jan 2015 11:44:58 +0100, Tavmjong Bah <tavmjong@free.fr> wrote:

>
> Hi,
>
> Both Inkscape and Mozilla have bug reports concerning an error in the
> feTurbulance random algorithm.[1][2] This bug results in squares being
> drawn for certain seed values. (Example[3]) There is a discussion of the
> problem on svg-developers.[4]
>
> The Inkscape bug report traces the problem to a divide by zero when both
> values in the fGradient table are zero which occurs for some seed
> values. A couple solutions are proposed in the comments.
>
> Tav
>
> [1] https://bugs.launchpad.net/inkscape/+bug/1406458
> [2] https://bugzilla.mozilla.org/show_bug.cgi?id=862225
> [3] https://launchpadlibrarian.net/193702227/turbulence-seed514.png
> [4]
> https://www.mail-archive.com/svg-developers@yahoogroups.com/msg16062.html
>

See [5] for how it's currently handled in skia (used in Chrome/Opera).  
Since the gradient vector here is a degenerate case the normalize method  
sets (0,0) as the "normalized" result [6].

Looking at what Presto did, it seems it avoided the division by zero by  
checking if the divisor was zero, leaving the vector unchanged if so,  
which I think will also result in (0,0).


[5]  
https://skia.googlesource.com/skia/+/master/src/effects/SkPerlinNoiseShader.cpp#180
[6] https://skia.googlesource.com/skia/+/master/src/core/SkPoint.cpp#69

-- 
Erik Dahlstrom, Web Technology Developer, Opera Software
Co-Chair, W3C SVG Working Group

Received on Friday, 9 January 2015 14:31:19 UTC