[cairo] introducing a "context backend"

Robert O'Callahan robert at ocallahan.org
Fri Apr 23 02:50:35 PDT 2010

On Fri, Apr 23, 2010 at 9:39 PM, Chris Wilson <chris at chris-wilson.co.uk>wrote:

> On Fri, 23 Apr 2010 11:59:12 +1200, "Robert O'Callahan" <
> robert at ocallahan.org> wrote:
> > How would people feel about introducing some kind of "context backend"
> that
> > lets pretty much all of the functionality of a cairo_t be passed straight
> > through to a platform context backend?
> The name I picked for this was cairo_gstate_backend_t, mostly to avoid the
> confusion that I think arises from cairo_backend_t/cairo_surface_backend_t.

Does you mean you'd have cairo_save/cairo_restore manage a stack of
cairo_gstate_backend_t? Because I was thinking they should be backend
functions instead...

How about 'cairo_context_backend_t'?

The goal is to then to pass the information to the backend immediately,
> and convert the existing implementation into a library of core helpers
> that the backends may choose to use or to assist them in their task.

That's one way to do it. With that approach, the existing backends would
fill their function tables with pointers to the "default implementation".

Another way to do it would be more like the surface backends; make the
default be NULL and have cairo_ functions call through to the backend
function if it's non-NULL, otherwise continue on with the default

Any particular reason to favour one approach over the other? Without having
thought about it much, the latter approach seems to me slightly easier and
less likely to regress performance (even a tiny bit) for existing backends.

"He was pierced for our transgressions, he was crushed for our iniquities;
the punishment that brought us peace was upon him, and by his wounds we are
healed. We all, like sheep, have gone astray, each of us has turned to his
own way; and the LORD has laid on him the iniquity of us all." [Isaiah
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cairographics.org/archives/cairo/attachments/20100423/784b66c9/attachment.htm>

More information about the cairo mailing list