[cairo] Cleanup patch for region handling

Carl Worth cworth at redhat.com
Tue Aug 16 14:35:01 PDT 2005


On Tue, 16 Aug 2005 10:14:47 -0400, Owen Taylor wrote:
> Here's a patch that splits out some existing code into utility
> functions:

Looks pretty good. A few minor comments below.

> cairo_private void
> _cairo_region_rectangle_extents (pixman_region16_t *region,
>                                  cairo_rectangle_t *rect);

I'd rename that to postfix the rectangle qualifier:

	_cairo_region_extents_rectangle

Just pretend English had postfix adjectives (adjectives postfix?) and
this style happens automatically. ;-)

> @@ -1207,32 +1207,6 @@ _composite_trap_region_solid (cairo_clip
>  			      cairo_surface_t       *dst,
>  			      pixman_region16_t     *region)
>  {
> -    int num_rects = pixman_region_num_rects (region);
> -    pixman_box16_t *boxes = pixman_region_rects (region);
> -    cairo_rectangle_t *rects;
...
> -    return status;
>  }

Uhm, was that function supposed to go away, and not just its body?


> @@ -614,15 +614,16 @@ _cairo_image_surface_composite (cairo_op
> -    if (!_cairo_operator_bounded (operator))
...
> +    if (status == CAIRO_STATUS_SUCCESS &&
> +	!_cairo_operator_bounded (operator))

I'm confused about the handling of status in this function. Is
_cairo_image_surface_set_attributes really supposed to return
cairo_int_status_t rather than cairo_status_t? I don't see any
UNSUPPORTED return values from there. Why aren't we just returning
early on non-SUCCESS status here and instead checking it over and
over?

> +    /* We can't use pixman_region_create_simple(), because it doesn't
> +     * have an error return
> +     */

That should be even easier to fix these days with the embedded
pixman. I don't know how important this is though.

> +++ src/cairo-xlib-surface.c	16 Aug 2005 13:52:18 -0000
> @@ -1138,15 +1138,16 @@ _cairo_xlib_surface_composite (cairo_ope
> -	if (!_cairo_operator_bounded (operator))
...
> +	if (status == CAIRO_STATUS_SUCCESS &&
> +	    !_cairo_operator_bounded (operator))

Ah, perhaps the question I had about image surface code was just due
to an analogue with this code, (where _cairo_xlib_surface_set_filter
can return UNSUPPORTED).

-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/20050816/b8d33e7a/attachment.pgp


More information about the cairo mailing list