From c11ed921743553da6c668ffd4f7ccb24d44b5147 Mon Sep 17 00:00:00 2001 From: sam Date: Sun, 9 Jan 2005 00:24:24 +0000 Subject: [PATCH] * use IPicture's DC instead of CreateCompatibleDC. * nicer error message. git-svn-id: file:///srv/caca.zoy.org/var/lib/svn/pwntcha/trunk@438 92316355-f0b4-4df1-b90c-862c8a59935f --- src/common.h | 1 + src/image.c | 14 ++++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/common.h b/src/common.h index 10349bc..9d215ea 100644 --- a/src/common.h +++ b/src/common.h @@ -18,6 +18,7 @@ struct image }; /* global variables */ +extern char *argv0; extern char *share; /* debug function */ diff --git a/src/image.c b/src/image.c index ee7b5bd..c0e9a2f 100644 --- a/src/image.c +++ b/src/image.c @@ -44,7 +44,7 @@ struct image *image_load(const char *name) LPPICTURE pic = NULL; HDC dc; long scrwidth = 0, scrheight = 0; - int width, height, i; + int width, height; void *data = NULL; #elif defined(HAVE_SDL_IMAGE_H) SDL_Surface *priv = IMG_Load(name); @@ -64,8 +64,7 @@ struct image *image_load(const char *name) return NULL; } - dc = CreateCompatibleDC(NULL); - +#if 0 for(i = 0; ; i++) { DEVMODE devMode; @@ -74,13 +73,16 @@ struct image *image_load(const char *name) if(EnumDisplaySettings(NULL, i, &devMode) != 1) break; - /* printf("mode %i x %i - %i\n", (int)devMode.dmPelsWidth, - (int)devMode.dmPelsHeight, (int)devMode.dmBitsPerPel); */ + printf("mode %i x %i - %i\n", (int)devMode.dmPelsWidth, + (int)devMode.dmPelsHeight, (int)devMode.dmBitsPerPel); } +#endif + + pic->lpVtbl->get_CurDC(pic, &dc); if(GetDeviceCaps(dc, BITSPIXEL) < 24) { - fprintf(stderr, "a screen depth of at least 24bpp is required\n"); + fprintf(stderr, "%s: 24bpp screen depth or better required\n", argv0); DeleteDC(dc); free(priv); return NULL;