Browse Source

* 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
master
sam 20 years ago
parent
commit
c11ed92174
2 changed files with 9 additions and 6 deletions
  1. +1
    -0
      src/common.h
  2. +8
    -6
      src/image.c

+ 1
- 0
src/common.h View File

@@ -18,6 +18,7 @@ struct image
}; };


/* global variables */ /* global variables */
extern char *argv0;
extern char *share; extern char *share;


/* debug function */ /* debug function */


+ 8
- 6
src/image.c View File

@@ -44,7 +44,7 @@ struct image *image_load(const char *name)
LPPICTURE pic = NULL; LPPICTURE pic = NULL;
HDC dc; HDC dc;
long scrwidth = 0, scrheight = 0; long scrwidth = 0, scrheight = 0;
int width, height, i;
int width, height;
void *data = NULL; void *data = NULL;
#elif defined(HAVE_SDL_IMAGE_H) #elif defined(HAVE_SDL_IMAGE_H)
SDL_Surface *priv = IMG_Load(name); SDL_Surface *priv = IMG_Load(name);
@@ -64,8 +64,7 @@ struct image *image_load(const char *name)
return NULL; return NULL;
} }


dc = CreateCompatibleDC(NULL);

#if 0
for(i = 0; ; i++) for(i = 0; ; i++)
{ {
DEVMODE devMode; DEVMODE devMode;
@@ -74,13 +73,16 @@ struct image *image_load(const char *name)
if(EnumDisplaySettings(NULL, i, &devMode) != 1) if(EnumDisplaySettings(NULL, i, &devMode) != 1)
break; 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) 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); DeleteDC(dc);
free(priv); free(priv);
return NULL; return NULL;


Loading…
Cancel
Save