[Webkit-unassigned] [Bug 30960] [CAIRO] shadow support for Canvas and SVG

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Nov 12 12:55:19 PST 2009


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


Benjamin Otte <otte at gnome.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |otte at gnome.org




--- Comment #8 from Benjamin Otte <otte at gnome.org>  2009-11-12 12:55:18 PST ---
> +static inline void copyContextProperties(cairo_t* srcCr, cairo_t* dstCr)
> +{
> +    cairo_set_antialias(dstCr, cairo_get_antialias(srcCr));
> +    double dashes, offset;
> +    cairo_get_dash(srcCr, &dashes, &offset);
> +    cairo_set_dash(dstCr, &dashes, cairo_get_dash_count(srcCr), offset);
>
This is wrong. cairo_get_dash() expects to be passed an array that has at least
cairo_get_dash_count(srcCr) members. This will write random memory if dash
count is > 1.

> +        cairo_stroke_extents(cr, &x0, &y0, &x1, &y1);
>
This is a nitpick, but I guess it wouldn't hurt to do it like this:
if (strokeShadow)
    cairo_stroke_extents(cr, &x0, &y0, &x1, &y1);
else
    cairo_fill_extents(cr, &x0, &y0, &x1, &y1);
Fill extents are smaller and faster to compute, though I guess this gets lost
in the noise of actually doing the blur.

> +     static void calculateShadowBufferDimensions(IntSize& shadowBufferSize, FloatRect& shadowRect, float& kernelSize, const FloatRect& sourceRect, const IntSize& shadowSize, int shadowBlur);
>
I dislike this function, because it has an ugly prototype. It has 2 out
variables and they even share the size. Also, the code always creates a blur
image afterwards and moves it. Wouldn't it be nicer to have a function like
createShadowImage() that does all of this and just returns the ImageBuffer ?

-- 
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