X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=winboard%2Fwinboard.c;h=67e950a75a0527e911f229bd98a9db3e6b0b0b41;hb=4099d0667f611390759e74b42cadf4325ee1f2cd;hp=07e4bd20de7e04c3641a3cffe5a0be6e8bb6246d;hpb=d39b0224115daf24fa2608e27d0ca16c8cd4aa70;p=xboard.git diff --git a/winboard/winboard.c b/winboard/winboard.c index 07e4bd2..67e950a 100644 --- a/winboard/winboard.c +++ b/winboard/winboard.c @@ -73,6 +73,7 @@ #include #include #include +#include #if __GNUC__ #include @@ -954,6 +955,24 @@ EnsureOnScreen(int *x, int *y, int minX, int minY) if (*y < minY) *y = minY; } +VOID +LoadLogo(ChessProgramState *cps, int n) +{ + if( appData.logo[n] && appData.logo[n][0] != NULLCHAR) { + cps->programLogo = LoadImage( 0, appData.logo[n], IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE ); + + if (cps->programLogo == NULL && appData.debugMode) { + fprintf( debugFP, "Unable to load logo bitmap '%s'\n", appData.logo[n] ); + } + } else if(appData.autoLogo) { + if(appData.firstDirectory && appData.directory[n][0]) { + char buf[MSG_SIZ]; + snprintf(buf, MSG_SIZ, "%s/logo.bmp", appData.directory[n]); + cps->programLogo = LoadImage( 0, buf, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE ); + } + } +} + BOOL InitInstance(HINSTANCE hInstance, int nCmdShow, LPSTR lpCmdLine) { @@ -1009,19 +1028,7 @@ InitInstance(HINSTANCE hInstance, int nCmdShow, LPSTR lpCmdLine) } /* [HGM] logo: Load logos if specified (must be done before InitDrawingSizes) */ - if( appData.firstLogo && appData.firstLogo[0] != NULLCHAR) { - first.programLogo = LoadImage( 0, appData.firstLogo, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE ); - - if (first.programLogo == NULL && appData.debugMode) { - fprintf( debugFP, "Unable to load logo bitmap '%s'\n", appData.firstLogo ); - } - } else if(appData.autoLogo) { - if(appData.firstDirectory && appData.firstDirectory[0]) { - char buf[MSG_SIZ]; - snprintf(buf, MSG_SIZ, "%s/logo.bmp", appData.firstDirectory); - first.programLogo = LoadImage( 0, buf, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE ); - } - } + LoadLogo(&first, 0); if( appData.secondLogo && appData.secondLogo[0] != NULLCHAR) { second.programLogo = LoadImage( 0, appData.secondLogo, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE ); @@ -3842,11 +3849,11 @@ HDCDrawPosition(HDC hdc, BOOLEAN repaint, Board board) boardRect.bottom - boardRect.top, tmphdc, boardRect.left, boardRect.top, SRCCOPY); if(saveDiagFlag) { - BITMAP b; int i, j=0, m, w, wb, fac=0; char pData[1000000]; + BITMAP b; int i, j=0, m, w, wb, fac=0; char *pData; BITMAPINFOHEADER bih; int color[16], nrColors=0; GetObject(bufferBitmap, sizeof(b), &b); - if(b.bmWidthBytes*b.bmHeight <= 990000) { + if(pData = malloc(b.bmWidthBytes*b.bmHeight + 10000)) { bih.biSize = sizeof(BITMAPINFOHEADER); bih.biWidth = b.bmWidth; bih.biHeight = b.bmHeight; @@ -3910,6 +3917,7 @@ HDCDrawPosition(HDC hdc, BOOLEAN repaint, Board board) // write bitmap data for(i=0; i