Skip to content

Commit

Permalink
*** empty log message ***
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Lantinga committed Jan 31, 2001
1 parent acf1afc commit 98834e6
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions showimage.c
Expand Up @@ -100,24 +100,29 @@ int main(int argc, char *argv[])
if ( image == NULL ) {
fprintf(stderr, "Couldn't load %s: %s\n",
argv[i], SDL_GetError());
SDL_Quit();
return(2);
continue;
}
SDL_WM_SetCaption(argv[i], "showimage");

/* Create a display for the image */
depth = SDL_VideoModeOK(image->w, image->h, 32, flags);
/* Use the deepest native mode, except that we emulate 32bpp
for viewing non-indexed images on 8bpp screens */
if ( depth == 0 ) {
if ( image->format->BytesPerPixel > 1 ) {
depth = 32;
} else {
depth = 8;
}
} else
if ( (image->format->BytesPerPixel > 1) && (depth == 8) ) {
depth = 32;
}
screen = SDL_SetVideoMode(image->w, image->h, depth, flags);
if ( screen == NULL ) {
fprintf(stderr,"Couldn't set %dx%dx%d video mode: %s\n",
image->w, image->h, depth, SDL_GetError());
SDL_Quit();
return(3);
continue;
}

/* Set the palette, if one exists */
Expand Down

0 comments on commit 98834e6

Please sign in to comment.