[cairo] performance difference between image and win32 surface?

Owen Taylor otaylor at redhat.com
Thu Oct 18 08:24:22 PDT 2007


On Thu, 2007-10-18 at 16:58 +0200, Danilo Gulamhussene wrote:
> Hi,
> 
> i have experimented a little with Cairo, cause we plan to use it for 
> rendering in a larger project.
> Some performance tests stated, that using a Win32 Surface is about 5 
> times slower than using an Image Surface on my system (Windows XP).
> (I wrote the small tests on my own, cause I did not manage yet to build 
> the performance tests included in Cairo.)
> 
> Could these results be correct, or am I doing something wrong?
> When yes, what is the reason for this performance difference? I would 
> find it much more straight forward to render directly into a Win32 
> Surface instead of rendering in an Image Surface and then copying it 
> into the window.

Many sorts of rendering in cairo needs to be done in software instead of
through the Windows API. So, to operate on a surface where
the pixels aren't directly accessible (a Window or a DDB), cairo needs
to copy data from the surface, operate it, and copy it back. This 
will be very slow if you are making lots of small operations.

You may find cairo_push_group() to be a convenient way to get good
performance without manually having to manipulate extra surfaces.

- Owen

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.cairographics.org/archives/cairo/attachments/20071018/83f9da6e/attachment.pgp 


More information about the cairo mailing list