[cairo] cairo_t usage

Ralf Stephan ralf at ark.in-berlin.de
Sat Nov 11 02:11:21 PST 2006

in an application that paints much pango text, I thought I could 
create a cairo context once and use it throughout the app lifetime.
(the cairo_t was from Gdk::Drawable::create_cairo_context()).

Now I'm getting CAIRO_STATUS_SURFACE_FINISHED errors and I'm not 
sure if I
- should have somehow used a surface with the context (I don't
  explicitly, I thought the Drawable is the surface for me)
- should create/destroy the cairo_t every time I'm painting on
  the Drawable (e.g., on every expose event) instead of keeping
  the cairo_t indefinitely

1. So, what's the recommended lifetime of a cairo_t?
2. Does a cairo_t created from a Gdk::Drawable need another surface?
   If not, why could there be CAIRO_STATUS_SURFACE_FINISHED errors
   despite the Drawable not having died or been destroyed?

I'll try to enhance the documentation with what I gain from your answers.


More information about the cairo mailing list