[Webkit-unassigned] [Bug 51446] ContextShadow uses inaccurate kernel size computation

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Dec 22 02:08:40 PST 2010


https://bugs.webkit.org/show_bug.cgi?id=51446


Alejandro G. Castro <alex at igalia.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |alex at igalia.com




--- Comment #3 from Alejandro G. Castro <alex at igalia.com>  2010-12-22 02:08:40 PST ---
(In reply to comment #0)
> The SVG spec, and FEGaussianBlur, compute the kernel size by multiplying the blur radius by
>   gGaussianKernelFactor = 3 / 4.f * sqrtf(2 * piFloat)
> 
> which becomes, in blurLayerImage,
> -    int d = max(2, static_cast<int>(floorf((2 / 3.f) * m_blurDistance)));
> +    int d = max(2, static_cast<int>(floorf(m_blurDistance / 2 * GaussianKernelFactor + 0.5f)));
> 
> This gives a more accurate radius for small shadows. It's noticeable on a 5px shadow.

I'm not sure if this is correct, in case of the gaussian blur we use that factor because we have the standard deviation, but in case of the canvas we have the blur distance.

Basically 2/3 is way to say that we are doing a box blur that increases d/2 pixels each time we do a box blur, and we do 3 box blurs. Therefore to get a distance of m_blurDistance we multiply by 2/3. We could modify the calculation and create a heuristic for the small distances because the rounding could cause problems though.

Actually I pointed hixie about the problems of having different APIs for the same operation in specs that are going to be implemented in the browser because it causes this kind of confusions.

 http://www.w3.org/Bugs/Public/show_bug.cgi?id=9942#c2

Hope it helps.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list