[cairo] Images with stride == width?

Behdad Esfahbod behdad at behdad.org
Tue Jan 20 11:41:31 PST 2009


Vladimir Vukicevic wrote:
> On 1/20/09 11:20 AM, Behdad Esfahbod wrote:
>> Strides not multiple of 4 never worked.  We just formalized it so you
>> get an
>> error message that makes sense, instead of NO_MEMORY or memory
>> corruption in
>> pixman.
> 
> Sure, but it sounds like the stride now has to be exactly width * 4?

The code in cairo_image_surface_create_for_data() doesn't agree:

    if ((stride & (CAIRO_STRIDE_ALIGNMENT-1)) != 0)
        return _cairo_surface_create_in_error (_cairo_error
(CAIRO_STATUS_INVALID_STRIDE));

    minstride = cairo_format_stride_for_width (format, width);
    if (stride < 0) {
        if (stride > -minstride) {
            return _cairo_surface_create_in_error (_cairo_error
(CAIRO_STATUS_INVALID_STRIDE));
        }
    } else {
        if (stride < minstride) {
            return _cairo_surface_create_in_error (_cairo_error
(CAIRO_STATUS_INVALID_STRIDE));
        }
    }


>     - Vlad
> 
> 


More information about the cairo mailing list