X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=draw.c;h=84fb6a1af617ad29d4d012370f7b236e8c60114c;hb=190cfda76b87b10514aa45bac061c3d4828ceffe;hp=d90d0e9fc2f33ed68c709697a78498ab6ebd8dd3;hpb=d91e42849d1a2d012335db5c5294ed573ec6d4d3;p=xboard.git diff --git a/draw.c b/draw.c index d90d0e9..84fb6a1 100644 --- a/draw.c +++ b/draw.c @@ -245,13 +245,13 @@ LoadSVG (char *dir, int color, int piece) char buf[MSG_SIZ]; RsvgHandle *svg=svgPieces[color][piece]; RsvgDimensionData svg_dimensions; - GError **svgerror=NULL; + GError *svgerror=NULL; cairo_surface_t *img; cairo_t *cr; snprintf(buf, MSG_SIZ, "%s/%s%s.svg", dir, color ? "Black" : "White", pngPieceNames[piece]); - if(svg || *dir && (svg = rsvg_handle_new_from_file(buf, svgerror))) { + if(svg || *dir && (svg = rsvg_handle_new_from_file(buf, &svgerror))) { rsvg_handle_get_dimensions(svg, &svg_dimensions); img = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, squareSize, squareSize); @@ -267,6 +267,8 @@ LoadSVG (char *dir, int color, int piece) return svg; } + if(svgerror) + g_error_free(svgerror); return NULL; } @@ -287,10 +289,10 @@ ScaleOnePiece (int color, int piece) if(!pngPieceImages[color][piece]) { // we don't have cached bitmap (implying we did not have cached svg) if(*appData.pieceDirectory) { // user specified piece directory snprintf(buf, MSG_SIZ, "%s/%s%s.png", appData.pieceDirectory, color ? "Black" : "White", pngPieceNames[piece]); - pngPieceImages[color][piece] = img = cairo_image_surface_create_from_png (buf); // try if there are png pieces there + img = cairo_image_surface_create_from_png (buf); // try if there are png pieces there if(cairo_surface_status(img) != CAIRO_STATUS_SUCCESS) { // there were not svgPieces[color][piece] = LoadSVG(appData.pieceDirectory, color, piece); // so try if he has svg there - } + } else pngPieceImages[color][piece] = img; } }