[cairo] API Shakeup: cairo_create and eliminating cairo_set_target_surface

Carl Worth cworth at redhat.com
Fri May 6 13:04:44 PDT 2005


On Thu, 05 May 2005 18:09:11 -0400, Owen Taylor wrote:
> A couple of small review comments on the patch ...

Owen, thanks once again for looking so close at this.

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

Fixed.

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

Fixed by just eliminating the cr->target field.

>  * 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().

Here's what I have for these two:

 * Note that there are restrictions on using the same surface in
 * multiple contexts at the same time. If, after creating @cr_a with
 * @surface you also create @cr_b with the same surface, you must
 * ensure that @cr_b has finished using @surface before resuming use
 * of @cr_a. Currently, the only way time at which this is guaranteed
 * is when the the last reference to @cr_b is released with
 * cairo_destroy(). (XXX: We need to add a cairo_finish() call to
 * provide a way to achieve this explicitly). See also the
 * %CAIRO_STATUS_BAD_NESTING status.

-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/20050506/71eb5db5/attachment.pgp


More information about the cairo mailing list