[cairo] New API proposal: cairo_restore_status()

Benjamin Otte otte at redhat.com
Tue Jan 11 14:07:52 PST 2011


On Tue, 2011-01-11 at 15:07 -0500, Jeff Muizelaar wrote:
> 1. What about situations where the errors are not recoverable?
> 
All errors on a cairo_t are recoverable. Maybe you know one that isn't,
but I haven't found one.
What wouldn't be recoverable is errors on the destination surface. But
those keep being permanent anyway.

> 2. What was the use case from Benjamin?
> 
The biggest use case is "user-generated" code that should not mess up
the whole graphics rendering.
The best example here is webkit-gtk and Swfdec (and I suspect Mozilla,
too, unless you do lots of error checking) where SVG or SWF files are
able to cairo_transform() with degenerate (or multiple
almost-degenerate) matrices that cause a CAIRO_STATUS_INVALID_MATRIX.
That's only really be avoidable by carefully checking matrices every
time before setting them.

There's also the case where you trigger a repaint of a bunch of widgetry
and some of it is sloppily coded and has a rare bug. You don't want a
bug in a single widget to stop all drawing, but recover from it and just
not draw that one broken widget. A recent example of such a case would
be webkit-gtk's "plugin does not exist" code that managed to mess up and
that made youtube pages render nothing but the header for people without
Flash plugin.

It's a bit like the XHTML vs HTML5 way of parsing files to me - you
don't want to mess up everything just because some tiny part along the
way is not well-formed.

Benjamin



More information about the cairo mailing list