check cairo errors

This commit is contained in:
Julien Danjou 2008-01-23 10:48:08 +01:00
parent 5c02326a1e
commit e8bc0dac62
1 changed files with 12 additions and 7 deletions

19
draw.c
View File

@ -267,6 +267,8 @@ draw_image(DrawCtx *ctx, int x, int y, int wanted_h, const char *filename)
source = cairo_xlib_surface_create(globalconf.display, ctx->drawable, ctx->visual, ctx->width, ctx->height);
surface = cairo_image_surface_create_from_png(filename);
if(cairo_surface_status(surface))
return;
cr = cairo_create (source);
if(wanted_h > 0 && (h = cairo_image_surface_get_height(surface)) > 0)
{
@ -286,16 +288,19 @@ draw_image(DrawCtx *ctx, int x, int y, int wanted_h, const char *filename)
Area
draw_get_image_size(const char *filename)
{
Area size;
Area size = { -1, -1, -1, -1 };
cairo_surface_t *surface;
surface = cairo_image_surface_create_from_png(filename);
cairo_image_surface_get_width(surface);
size.x = 0;
size.y = 0;
size.width = cairo_image_surface_get_width(surface);
size.height = cairo_image_surface_get_height(surface);
cairo_surface_destroy(surface);
if(!cairo_surface_status(surface))
{
cairo_image_surface_get_width(surface);
size.x = 0;
size.y = 0;
size.width = cairo_image_surface_get_width(surface);
size.height = cairo_image_surface_get_height(surface);
cairo_surface_destroy(surface);
}
return size;
}