[cairo-commit] src/cairo-glitz-surface.c
Jinghua Luo
jinghua at kemper.freedesktop.org
Sat Nov 22 18:39:42 PST 2008
src/cairo-glitz-surface.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
New commits:
commit 36c1b3e5919f119a054e425ca03f7ce810d3e7ec
Author: Luo Jinghua <sunmoon1997 at gmail.com>
Date: Sun Nov 23 10:27:49 2008 +0800
glitz: fixup a stupid bug in get_image.
_pixman_format_from_masks returns a boolean instead of cairo status code.
Without this fix, get_image bails out over and over again even operations
was completed successfully. :-(
diff --git a/src/cairo-glitz-surface.c b/src/cairo-glitz-surface.c
index eb06643..3c3fe16 100644
--- a/src/cairo-glitz-surface.c
+++ b/src/cairo-glitz-surface.c
@@ -261,11 +261,12 @@ _cairo_glitz_surface_get_image (cairo_glitz_surface_t *surface,
surface->clip_boxes,
surface->num_clip_boxes);
- status = _pixman_format_from_masks (&masks, &pixman_format);
- if (status) {
- free (pixels);
- return status;
+ if (! _pixman_format_from_masks (&masks, &pixman_format))
+ {
+ status = _cairo_error (CAIRO_STATUS_INVALID_FORMAT);
+ goto FAIL;
}
+
image = (cairo_image_surface_t*)
_cairo_image_surface_create_with_pixman_format ((unsigned char *) pixels,
pixman_format,
@@ -273,7 +274,10 @@ _cairo_glitz_surface_get_image (cairo_glitz_surface_t *surface,
height,
pf.bytes_per_line);
if (image->base.status)
+ {
+ status = image->base.status;
goto FAIL;
+ }
_cairo_image_surface_assume_ownership_of_data (image);
@@ -283,7 +287,7 @@ _cairo_glitz_surface_get_image (cairo_glitz_surface_t *surface,
FAIL:
free (pixels);
- return _cairo_error (CAIRO_STATUS_NO_MEMORY);
+ return status;
}
static void
More information about the cairo-commit
mailing list