[cairo] Patch improving fallbacks

Owen Taylor otaylor at redhat.com
Mon Jan 31 13:07:00 PST 2005

On Mon, 2005-01-31 at 09:20 -0800, Keith Packard wrote:
> Around 11 o'clock on Jan 31, Owen Taylor wrote:
> > image_extra is just a void * for the backend to save a pointer
> > to backend specific resources.
> If it's part of the image, it seems like we should tie it to the image 
> instead of having to carry it around separately.  It seems mystic to have 
> this separate argument floating around.

It's just private API :-) ... I was trying to keep my changes as
simple, and because the API was already paired adding the void ** was 
simple and didn't get into other issues.

If we can come up with a good user data system for surfaces, then
we could remove this.

My current thought for user data for surfaces is something pretty

 cairo_key_t cairo_key_alloc (void);

 cairo_status_t cairo_surface_set_data (cairo_key_t  key,
                                        void        *data,
                                        void       (*destroy) (void *data));

 void *cairo_surface_get_data (cairo_key_t key);

When the surface is destroyed, all associated data is destroyed
as well. (The cairo_status_t is needed because there would be
a linked list internally.)

This would be useful for handling things like creating a 
cairo_xlib_surface_t for a GdkPixbuf as well, and reverse association
for language bindings.

 - Single user data has generally turned out to be a bad idea in 
   the past. Two people try to do it at once.
 - User data without destroy notifiers is much, much less useful.


-------------- 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/20050131/5ba02eff/attachment.pgp

More information about the cairo mailing list