[cairo] fixing cairo_(fill,stroke)_extents [patch]

Carl Worth cworth at cworth.org
Mon Sep 25 16:34:02 PDT 2006


On Thu, 14 Sep 2006 15:19:37 +1200, Robert O'Callahan wrote:
> They also don't handle the "no path" case well. cairo_stroke_extents
> returns something odd when it should just return something empty (e.g.
> x1,y1=x2,y2=0,0.) cairo_fill_extents also returns something odd. I'm
> actually not sure what it *should* return, but for now I'm having it
> return the surface extents.

Why shouldn't cairo_fill_extents also just return an all 0 extent
structure? A fill of an empty path is definitely a no-op.

> For the clip-getters patch which is coming up, I needed to add an
> is_tight output to _cairo_matrix_transform_bounding_box, and because I'm
> too lazy to reconstruct these fill/stroke_extents fixes without that
> change, I'm including it here as the first patch to commit.

Yeah, that looks fine.

> For bonus points, I added doc-comments for
> cairo_fill/stroke_extents.

Excellent; thanks! Other than the "infinite fill of empty path",
(which I think is wrong), the patch looks good. So if you'd like to
clean that up and then push the patch, that would be fine with me.

> +    if (extents.p1.x >= extents.p2.x || extents.p1.y >= extents.p2.y) {
> +        /* no traps, so we fill the surface */
> +        cairo_rectangle_int16_t surface_extents;

Yikes! Is cairo_fill currently acting like that? It's not documented
that way, and if it is acting like that I consider it a bug.

> + * Computes a bounding box in user coordinates covering all area that will
> + * be filled by the current path. If the current path is empty, returns the
> + * extents of the current target surface; otherwise, surface dimensions and
> + * clipping are not taken into account.

If we fix the bug above, then obviously this would change to.

-Carl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20060925/13f6c081/attachment.pgp


More information about the cairo mailing list