[cairo] Crash with very large image surface

Laszlo Pandy laszlok2 at gmail.com
Mon May 22 22:20:24 PDT 2006


I am a developer with Jokosher (www.jokosher.org), an audio editing 
application. We are currently using cairo to draw the (very beautiful) 
waveforms, for which the image width depends on the length of the song. We 
also want to have a zoom feature allowing the width to be increased almost 
infinitely, to see the detailed levels in the audio. At first we drew 
straight to the screen, but that was taking too long to redraw, so we are now 
using an image surface which is redrawn periodically.

My problem is that any image surface with a width over 32000 pixels causes an 
X server "BadAlloc" error. It complains that is it out of memory after 
setting the source surface to the large image surface and calling 
cairo_paint(). This also happens after using cairo_clip() on a small (100 by 
100) rectangle.

I have created a small program that I attached which replicates the crash. If 
you click in the window of this program repeatedly, it will increase the size 
of the image surface until it crashes and it reports that it failed on 
X_CreatePixmap after trying to do cairo_paint() with a 32800x400 image 
surface.

I would like to know if this a bug or the intended behaviour? Should cairo 
still be putting the entire image surface onto an XPixmap even though I have 
called cairo_clip() using a much smaller area?
If this is not a bug, is there anyway I can extract the area I want to draw 
from the image surface without drawing it all to a pixmap and crashing the 
program?

Laszlo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cairo-jokosher.c
Type: text/x-csrc
Size: 1775 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20060523/fe63021a/cairo-jokosher.c
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Makefile
Type: text/x-makefile
Size: 274 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20060523/fe63021a/Makefile.bin


More information about the cairo mailing list