[cairo] Background image

Daniel Amelang daniel.amelang at gmail.com
Fri Feb 16 10:54:33 PST 2007

On 2/16/07, Olivier Jolet <olivier.jolet at skynet.be> wrote:
> -----Message d'origine-----
> De: Daniel Amelang [mailto:daniel.amelang at gmail.com]
> Envoyé: jeudi 15 février 2007 21:26
> À: Olivier Jolet
> Cc: cairo at cairographics.org
> Objet: Re: [cairo] Background image
> On 2/15/07, Olivier Jolet <olivier.jolet at skynet.be> wrote:
> > I need to use a background image (of course always the same).
> >
> > Actually, I draw the background image in a surface "surfBG " and
> before each
> > draw, I use
> >
> > cairo_set_source_surface (cr, surfBG, 0, 0);
> >
> > cairo_paint (cr);
> >
> > But I'm not sure that's the better way to do it...
> >
> > Is there a better method to use a background?
> Looks good to me. Are you running into some problem with this method?
> Dan
> No, I don't have problem with this method. But the display is very slow
> (zoom in & out with the scroll mouse button) and I thought that it could
> be because of the background. Apparently it's not that. Perhaps it's
> because of the many primitive functions to draw a big graphic? I should
> perhaps try to use GLX backend...

It's quite possible that you don't have to use the glitz backend to
get a nice speedup. Alex Mac recently sped up his lander game from 6
fps to 70 fps by just optimizing his own code to use cairo more

The lander game (with full source code):


The cairo thread about optimizing the game:


If you share your code (and maybe some profiles, too), it's likely
that someone on this list will also help you get better performance
without having to use a different backend.


More information about the cairo mailing list