[cairo] introducing a "context backend"
spitzak at gmail.com
Fri Apr 23 12:57:37 PDT 2010
Wow! That looks right to me!
Amazing work if this was just done recently!
I would move the status checks to the backend functions. This will allow
them to skip the pre-test in cases where setting things is harmless, and
to skip the post-test if they know they could not possibly have caused
an error, or in the common case where they directly detect the error and
set the status. The frontend should be *exactly*
"cr->backend->foo(cr,...)" with no extra code.
It looks like there is one backend already, the "gstate" one, right?
An backend to implement is the "cairo recorder". Also (may be the same
class) a debugging wrapper for another cairo_t that records all the
calls, and checks the status everywhere and can then call a user-defined
function on errors. A hit-detection backend would also be nice.
Chris Wilson 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?
> Every problem can be solved with a new layer of abstraction:
> It is complete in the sense that everything is unchanged bar the new vfunc.
> Comments? Anybody going to whip up a quick proof-of-principle backend?
More information about the cairo