[cairo] API Shakeup: cairo_create and eliminating cairo_set_target_surface

Owen Taylor otaylor at redhat.com
Thu May 5 15:09:11 PDT 2005


On Thu, 2005-05-05 at 17:29 -0400, Carl Worth wrote:
> On Wed, 16 Feb 2005 01:07:36 -0500, Carl Worth wrote:
> > To address these issues, I propose to change the API so that a single
> > cairo_t context cannot be re-targeted. Instead, the association of a
> > target surface must take place at the time of cairo_create:
> > 
> > 	/* Create a new cairo context, targeting the given surface. */
> > 	cairo_t *
> > 	cairo_create (cairo_surface_t *target);
> 
> Here's a patch that implements this new cairo_create call, (and that
> removes all of the cairo_set_target functions).

A couple of small review comments on the patch ...

 * in _cairo_gstate_init(), you call _cairo_gstate_set_target_surface()
   without checking the status, but that function can fail.

 * In _cairo_create(), if _cairo_gstate_create() fails, cr->target isn't
   referenced, but you don't set it back to NULL.

 * In the cairo_create() docs you refer to "setting @surface as the
   target surface of @cr_a" ... "using" would be better than "setting"
   with the current API.

 * I think it might be good to keep a FIXME in cairo_create() pointing
   to cairo_finish() in order to unset the target surface explicitly,
   so we don't forget to add that back to the docs when we add
   cairo_finish().

Regards,
					Owen

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.freedesktop.org/archives/cairo/attachments/20050505/905fe6da/attachment.pgp


More information about the cairo mailing list