* Massachusetts.
*
* Enhancements Copyright 1992-2001, 2002, 2003, 2004, 2005, 2006,
- * 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Free Software Foundation, Inc.
+ * 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 Free
+ * Software Foundation, Inc.
*
* The following terms apply to Digital Equipment Corporation's copyright
* interest in XBoard:
#include <stdio.h>
#include <math.h>
#include <cairo/cairo.h>
-#include <cairo/cairo-xlib.h>
#include <librsvg/rsvg.h>
#include <librsvg/rsvg-cairo.h>
#include <pango/pangocairo.h>
static cairo_surface_t *pngPieceImages[2][(int)BlackPawn]; // png 256 x 256 images
static cairo_surface_t *pngPieceBitmaps[2][(int)BlackPawn]; // scaled pieces as used
static cairo_surface_t *pngPieceBitmaps2[2][(int)BlackPawn]; // scaled pieces in store
-static RsvgHandle *svgPieces[2][(int)BlackPawn+4]; // vector pieces in store
+static RsvgHandle *svgPieces[2][(int)BlackPawn]; // vector pieces in store
static cairo_surface_t *pngBoardBitmap[2], *pngOriginalBoardBitmap[2];
int useTexture, textureW[2], textureH[2];
textureW[kind] = 0; // prevents bitmap from being used if not succesfully loaded
if(strstr(s, ".png")) {
cairo_surface_t *img = cairo_image_surface_create_from_png (s);
- if(img) {
+ if(cairo_surface_status(img) == CAIRO_STATUS_SUCCESS) {
char c, *p = s, *q;
int r, f;
if(pngOriginalBoardBitmap[kind]) cairo_surface_destroy(pngOriginalBoardBitmap[kind]);
{
int i, p;
if(reloadPieces)
- for(i=0; i<2; i++) for(p=0; p<BlackPawn+4; p++) {
+ for(i=0; i<2; i++) for(p=0; p<BlackPawn; p++) {
if(pngPieceImages[i][p]) cairo_surface_destroy(pngPieceImages[i][p]);
pngPieceImages[i][p] = NULL;
if(svgPieces[i][p]) rsvg_handle_close(svgPieces[i][p], NULL);