[cairo] Re: SVG Spacewar

Steve Chaplin stevech1097 at yahoo.com.au
Fri Apr 1 05:34:25 PST 2005

On Thu, 2005-03-31 at 11:13 -0800, cairo-request at cairographics.org
> In particular, like all game programmers, I would like it to run as fast
> as possible, and that means employing glitz.  But how do I know if I'm
> running glitz (I downloaded the snapshot and I think it's installed, but
> my CPU seems to be rather busy)?  If I'm not, how do I switch to glitz?
> If it matters, I am running Fedora Core 3 with nVidia binary drivers.
> But also, scaling the whole thing by a small-ish factor (x1.25, try
> pressing "[" or "]" when playing) or enlarging the app's window seems to
> bring it to its knees (100% CPU use, and "top" just reports the culprit
> as 99% "X") - certainly it doesn't seem like an O(N^2) kind of thing.
> Any hints on how to profile, or what I'm doing wrong?

Resizing the svgspacewar window is incredibly slow. Looking at the
gtkcairo src I see:
The 'paint' sequence involves
gtk_cairo_expose() which calls
gdkcairo_expose() which calls
cairo_set_target_drawable() which is a slow function (according to the
svgspacewar triggers this sequence 25 times per second.

Possible improvements for GTKCAIRO_BACKEND=xlib
1) Only call cairo_set_target_drawable() once (and also when the
gdk_window is resized?), not on every gdk_cairo_expose()

2) gdk_cairo_expose() could make use of the new cairo functions:

   which are probably more efficient than


More information about the cairo mailing list