[cairo] Best strategy for complex screen drawing

Vladimir Vukicevic vladimirv at gmail.com
Sun Nov 20 16:20:05 PST 2005


On 11/20/05, Timothée Lecomte <timothee.lecomte at ens.fr> wrote:
>
> Here are the main questions :
>
> 1) Would it be more efficient to use a gdk/cairo surface for the screen
> (via gdk_cairo_create) and use cairo_set_source_surface to copy the
> image surface to the screen ? (instead of the image buffer conversion) I
> suppose the answer is no.

See answer to #2.

> 2) Would it be more efficient to use a specific backend ? For example,
> should I draw to an offscreen Xlib pixmap, and use it as a source
> surface ? Will I benefit from possible render acceleration ?

It would be more efficient to use a specific platform offscreen
surface; the image surface is really the slowest possible path.  Using
a platform native surface will also let you take advantage of RENDER
acceleration or specific windows/mac/etc. accelerations.  Using an
offscreen pixmap also makes your screen update very fast if you use a
native cairo surface for your X window -- because the blit will
ideally happen on the video card, or at least in the X server.

> 3) Are there other solutions that I might have forgotten ?

Not really; make sure you're following all the FAQs regarding fast
rendering (e.g. drawing pixel-aligned rectangles and lines correctly).
 Trying to combine your polygons into a single path may help as well? 
Other than that, some sample code that shows the performance issues
would be useful.

    - Vladimir


More information about the cairo mailing list