Replace Flying Dragon piece image by Gnu
[xboard.git] / draw.c
diff --git a/draw.c b/draw.c
index 1ac50c6..a2713ee 100644 (file)
--- a/draw.c
+++ b/draw.c
@@ -171,6 +171,8 @@ SelectPieces(VariantClass v)
           pngPieceBitmaps[i][(int)WhiteHorned]  = pngPieceBitmaps2[i][(int)WhiteUnicorn];
           pngPieceBitmaps[i][(int)WhiteStag]    = pngPieceBitmaps2[i][(int)WhiteSilver];
           pngPieceBitmaps[i][(int)WhiteEagle]   = pngPieceBitmaps2[i][(int)WhiteFalcon];
+          pngPieceBitmaps[i][(int)WhiteMan]     = pngPieceBitmaps2[i][(int)WhiteCopper];
+          pngPieceBitmaps[i][(int)WhiteCopper]  = pngPieceBitmaps2[i][(int)WhiteMan];
        }
     }
 }
@@ -288,10 +290,10 @@ CreatePNGBoard (char *s, int kind)
 char *pngPieceNames[] = // must be in same order as internal piece encoding
 { "Pawn", "Knight", "Bishop", "Rook", "Queen", "Advisor", "Elephant", "Archbishop", "Marshall", "Gold", "Commoner",
   "Canon", "Nightrider", "CrownedBishop", "CrownedRook", "Crown", "Chancellor", "Hawk", "Lance", "Cobra", "Unicorn", "Lion",
-  "Tile", "Tile", "Tile", "Tile", "Tile",
+  "Wolf", "Camel", "Zebra", "Wizard", "Lance",
   "GoldPawn", "Claw", "PromoHorse", "PromoDragon", "GoldLance", "PromoSword", "Prince", "Phoenix", "Kylin", "PromoRook", "PromoHSword",
   "Dolphin", "Sword", "Leopard", "HSword", "GoldSilver", "Princess", "HCrown", "Knight", "Elephant", "PromoBishop",
-  "Tile", "Tile", "Tile", "Tile", "Tile", "King",
+  "Gnu", "Viking", "Iron", "Copper", "Tower", "King",
   "Claw", "GoldKnight", "GoldLance", "GoldSilver", NULL
 };
 
@@ -657,18 +659,25 @@ DrawLogo (Option *opt, void *logo)
     cairo_t *cr;
     int w, h;
 
-    if(!logo || !opt) return;
-    img = cairo_image_surface_create_from_png (logo);
-    w = cairo_image_surface_get_width (img);
-    h = cairo_image_surface_get_height (img);
+    if(!opt) return;
     cr = cairo_create(DRAWABLE(opt));
-//    cairo_scale(cr, (float)appData.logoSize/w, appData.logoSize/(2.*h));
-    cairo_scale(cr, (float)opt->max/w, (float)opt->value/h);
-    cairo_set_source_surface (cr, img, 0, 0);
-    cairo_paint (cr);
+    cairo_rectangle (cr, 0, 0, opt->max, opt->value);
+    cairo_set_source_rgba(cr, 0.5, 0.5, 0.5, 1.0);
+    cairo_fill(cr); // paint background in case logo does not exist
+    if(logo) {
+        img = cairo_image_surface_create_from_png (logo);
+        if(cairo_surface_status(img) == CAIRO_STATUS_SUCCESS) {
+           w = cairo_image_surface_get_width (img);
+           h = cairo_image_surface_get_height (img);
+//        cairo_scale(cr, (float)appData.logoSize/w, appData.logoSize/(2.*h));
+           cairo_scale(cr, (float)opt->max/w, (float)opt->value/h);
+           cairo_set_source_surface (cr, img, 0, 0);
+           cairo_paint (cr);
+        }
+       cairo_surface_destroy (img);
+    }
     cairo_destroy (cr);
-    cairo_surface_destroy (img);
-    GraphExpose(opt, 0, 0, appData.logoSize, appData.logoSize/2);
+    GraphExpose(opt, 0, 0, opt->max, opt->value);
 }
 
 static void