[cairo] Best strategy for complex screen drawing

Vladimir Vukicevic vladimirv at gmail.com
Mon Nov 21 17:42:16 PST 2005

On 11/21/05, Timothée Lecomte <timothee.lecomte at ens.fr> wrote:
> Thanks for these details ! Let's talk about the way I should implement it.
> Under X11 via gdk, I draw offscreen to a GdkPixmap thanks to
> gtk_cairo_create(GdkPixmap*).
> Then, I copy this pixmap to the screen with gdk_draw_drawable() when I
> receive a "window-must-be-painted" event.
> With such code, the initial drawing takes approximately 0.2 milliseconds
> per polygon (pretty slow), and the copy to the screen is almost satisfying.
> Does it correspond to the scheme you were describing ? Can this be
> improved ?

That's pretty much what you should be doing; some future toolkits may
allow you to directly draw into the back buffer of a widget and have
the update happen automatically.  Quartz essentially does this on OSX;
windows and X can do it if you jump through some hoops, but it's not
worth it since it requires you to depend on features that may not be
universally available (on X especially).  So I'd suggest you keep
doing it the way you're doing it for maximum portability for now.

    - Vlad

More information about the cairo mailing list