print cairo errors

This commit is contained in:
Julien Danjou 2008-01-23 13:47:56 +01:00
parent e8bc0dac62
commit 0b678ce0c2
1 changed files with 12 additions and 2 deletions

14
draw.c
View File

@ -264,11 +264,15 @@ draw_image(DrawCtx *ctx, int x, int y, int wanted_h, const char *filename)
int h;
cairo_surface_t *surface, *source;
cairo_t *cr;
cairo_status_t cairo_st;
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))
if((cairo_st = cairo_surface_status(surface)))
{
warn("failed to draw image %s: %s\n", filename, cairo_status_to_string(cairo_st));
return;
}
cr = cairo_create (source);
if(wanted_h > 0 && (h = cairo_image_surface_get_height(surface)) > 0)
{
@ -290,9 +294,15 @@ draw_get_image_size(const char *filename)
{
Area size = { -1, -1, -1, -1 };
cairo_surface_t *surface;
cairo_status_t cairo_st;
surface = cairo_image_surface_create_from_png(filename);
if(!cairo_surface_status(surface))
if((cairo_st = cairo_surface_status(surface)))
{
warn("failed to get image size %s: %s\n", filename, cairo_status_to_string(cairo_st));
return;
}
else
{
cairo_image_surface_get_width(surface);
size.x = 0;