[cairo] Slow painting of images

Carl Worth cworth at cworth.org
Fri Nov 4 09:35:12 PST 2005


On Wed, 26 Oct 2005 14:12:26 +0200, Haakon Riiser wrote:
> 
> I've recently started experimenting with the Cairo library, and I
> think I'm doing something wrong.  I'm trying to display some PNG
> images, and although it works, it is _extremely_ slow.  Take a look
> at the test program shown below

The code in your program looks just fine.

I think what's happening here is that your X server is using a very
slow means of transforming images. Try commenting out the call to
cairo_scale in your program and see if it doesn't get much faster. If
it does, then we know it's the image transformation operation that is
hurting.

Cairo uses the X server's Render extension to transform images. With
some combinations of hardware and X server drivers the Render
extension can provide accelerated image transformation. However, when
this is not available, you get Render's software image transformation
which is a piece of code that clearly needs some optimization work.

I don't know what your application needs are, but you might be able to
work around slow image transformation by transforming once, (for
example, paint into an intermediate surface created with
cairo_surface_create_similar), and then subsequently using that result
without additional transformation.

I hope that's of some help.

-Carl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20051104/a177409c/attachment.pgp


More information about the cairo mailing list