[cairo] Cleaning up the PDF API

Carl Worth cworth at cworth.org
Mon May 16 16:15:07 PDT 2005

On Mon, 16 May 2005 11:41:13 -0400, Kristian Høgsberg wrote:
> No, this is different.  The cairo_destroy_func_t passed in here is
> called when cairo_surface_finish() is called on the surface.  It's
> responsible for e.g. flushing out any buffers and fclose()'ing FILE's at
> the time we know that no more output will be going to the stream.

I was talking with Keith about this today. He had a good insight which
I saw him type up, but I haven't seen it hit the list.

The point is that the final destruction of the surface is not under
synchronous user control. Hence, the user_data callback is useful to
inform the user about this asynchronously.

However, the active->finished transition only happens under explicitly
user control, (a call to cairo_surface_finish). So if the user needs
something to happen at that transition, the user can do so then.

In fact, this is the very purpose of cairo_surface_finish. It allows
the user to force cairo to synchronize and finish its use of the
surface so that the user knows that it is safe to flush buffers and
close files etc.

So I propose eliminating the callback from cairo_pdf_surface_create.
It might still be quite useful for the user to attach user_data to the
surface in order to do something with it after the "finish"
transition. (And this is another argument that in fact user_data must
stick around after "finish" --- so I was totally off in the other
branch of this thread).

-------------- 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/20050516/ca24b0da/attachment.pgp

More information about the cairo mailing list