[cairo] Road to 1.10
M Joonas Pihlaja
jpihlaja at cc.helsinki.fi
Sun Feb 15 07:37:40 PST 2009
On Thu, 12 Feb 2009, Chris Wilson wrote:
> This is what I've found from diffing the headers since 1.8...
[snip]
> New experimental backends:
>
> Simple DirectMedia Layer
> CairoScript
Regarding the SDL backend, could we drop it before it gets any more
use? While it certainly makes cairo/SDL integration a bit easier,
it's not really doing all that much, but does have its own set of
problems in turn:
- Makes assumptions about SDL_Surface locking semantics that aren't
necessarily true; namely that SDL_Surface->pixels is valid and stays
constant.
- Is impossible to use correctly with 32 bit SDL_Surfaces which use
per-pixel alpha. SDL's pixel format is unpremultiplied vs. cairo's
premultiplied format. The pixels end up in cairo's format in the
SDL_Surface and later when blitting using SDL things look wrong.
There are also some minor issues like allowing any pixman supported
format to be used with cairo instead of the few CAIRO_FORMAT_* ones.
While we could fix most of the problems in the implementation, we'd
still be left in a situation where we're shipping a surface which
doesn't bring much value to the table. The main thing that it does
provide that the user cannot at present do themselves is damage
tracking. Even there, it's notifying SDL_Surfaces immediately after
rendering, but that's not necessarily what the user wants to happen!
Since SDL integration mainly boils down to pretty much just "make an
image surface, unpremultiply sometimes", I don't think it needs its
own surface. For the unpremultiplication part, I've put together a
set of helper functions that make that nearly transparent, so that all
the user needs to do is indicate that they'd like the contents of the
image surface to be flushed to the SDL_Surface now. It's available
(with demos) at
http://cgit.freedesktop.org/~joonas/cairosdl/
So if there aren't strong objections, I'd like to go ahead and take
the cairo_sdl_surface_t out.
Cheers,
Joonas
More information about the cairo
mailing list