[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cairo
Subject:    Re: [cairo] mime-surface
From:       "Benjamin Otte" <otte () gnome ! org>
Date:       2008-11-19 9:58:03
Message-ID: a4ed255b0811190158j12727788m75d16b1b4908e145 () mail ! gmail ! com
[Download RAW message or body]

Yay, that was fast. And it looks pretty much perfect to me. Some tiny
nitpicks on the API:

> static cairo_status_t
> decode_png (cairo_surface_t *surface,
>            const char *mime_type,
>            cairo_surface_t *_image)
>
I don't think we need to pass the mime type here. And if you need it
you can cairo_surface_set_user_data() it beforehand.
I'm also not sure if passing an image surface or data/stride is better
here. I guess an image surface is preferrable, even though it allows
more nasty tricks by the decoding function (like creating a cairo_t on
it or acquiring a reference and using the image surface for other
nefarious purposes later).

You didn't investigate the idea of giving the decoder a rectangle of
the area of interest to decode?
I think the usefulness of this was one of the open points we still had.
But we can still add it later using
cairo_mime_surface_set_region_decode_function() or so.

>    if (mime_data == NULL)
>        return _cairo_error (CAIRO_STATUS_NULL_POINTER);
>
_cairo_error() is internal API, so you likely want to just return
CAIRO_STATUS_NULL_POINTER here and do an
if (status)
  _cairo_error(status);
after returning from the user-provided callback, right?

>   surface = cairo_mime_surface_create (content,
>                                        CAIRO_MIME_TYPE_PNG,decode_png,
>                                        width, height);
>
I think specifying width/height on surface creation is fine, but I'm
just one user - or two, if you count my gdk-pixbuf knowledge, where it
should be fine, too - You'd defer creating the surface until the size
of the image is known. But is there a use case for determining the
size using a callback and/or during the decode function?

> Is the simple interface both minimal and sufficient for expected users?
>
It's certainly minimal enough. I think other things could be added
later by extending the mime surface API if we figure out we need
something.

Cheers,
Benjamin
_______________________________________________
cairo mailing list
cairo@cairographics.org
http://lists.cairographics.org/mailman/listinfo/cairo
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic