diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2007-10-01 17:00:38 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2007-10-01 19:50:07 +0100 |
commit | c9a9f1299c2bd5b6a8e53fdb264c233a43e0c44a (patch) | |
tree | 36a87581474008993633e072eb092f05ddccf7a3 /src/cairo-image-surface.c | |
parent | e241205f0c6d823150cf018c0deb6652dd8b8d02 (diff) |
[cairo-image-surface] Avoid trying to create surfaces with invalid strides.
pixman does not (yet?) support arbitrary strides and will fail to
generate an image for the data. We misinterpret that failure as a
CAIRO_STATUS_NO_MEMORY, so instead return CAIRO_STATUS_INVALID_FORMAT
before attempting to create the pixman image.
Diffstat (limited to 'src/cairo-image-surface.c')
-rw-r--r-- | src/cairo-image-surface.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/cairo-image-surface.c b/src/cairo-image-surface.c index 0a6568be..64593292 100644 --- a/src/cairo-image-surface.c +++ b/src/cairo-image-surface.c @@ -541,7 +541,10 @@ cairo_image_surface_create_for_data (unsigned char *data, { pixman_format_code_t pixman_format; - if (! CAIRO_FORMAT_VALID (format)) { + /* XXX pixman does not support images with arbitrary strides and + * attempting to create such surfaces will failure but we will interpret + * such failure as CAIRO_STATUS_NO_MEMORY. */ + if (! CAIRO_FORMAT_VALID (format) || stride % sizeof (uint32_t) != 0) { _cairo_error (CAIRO_STATUS_INVALID_FORMAT); return (cairo_surface_t*) &_cairo_image_surface_nil_invalid_format; } |