[cairo] Images with stride == width?

Ian Britten britten at caris.com
Tue Jan 20 10:13:42 PST 2009


Chris Wilson wrote:

>> As such, it seems that you cannot make an image surface from an
>> existing block of image data, and will always have to create a
>> new buffer (Using the calculated stride), and copy your source
>> data into the temporary buffer (And then create the image surface
>> using that temporary buffer).
> 
> In general this is true. Note this problem is even more complicated if
> you need to create a surface for h/w acceleration as each piece of h/w
> has it own limitations for valid strides, widths and heights. 

Is it normal/expected for the stride value to be (much) larger than
the requested width?  Or have I messed up somewhere?

In the case I'm debugging at the moment, I'm starting with 24-bit RGB
data that's 2171 x 2450 (Which is roughly 121M by my calculations)

For that width, I get a stride value of *9800*, which frankly seems a
bit inflated (to say the least).  Since Cairo uses 32-bit RGB data,
I'll need a memory buffer of 2171 x 9800 x 32 = 640M -> Over 5 times
the memory, for the same data...
[ I dread to think what'll happen when I get to *big* images... :( ]

FYI - cairo 1.8.6 on a 64-bit Mandriva 2008.1 box, if it matters

Thanks for any info!
Ian



More information about the cairo mailing list