[cairo] Images with stride == width?
Owen Taylor
otaylor at redhat.com
Tue Jan 20 10:53:18 PST 2009
On Tue, 2009-01-20 at 14:13 -0400, Ian Britten wrote:
> 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... :( ]
It's not a coincidence that 9800 == 2450 * 4. Stride is in bytes.
- Owen
More information about the cairo
mailing list