VIDEO: Allow SCREENSHOT command to optionally specify bitmap file extension
When PNG support is available, both .png and .bmp screenshots can be generated based on the file extension specified by the user on the SCREENSHOT command. If no extension is specified, then a PNG format screenshot will be produced.
This commit is contained in:
parent
a24aba69ae
commit
d741bdc375
1 changed files with 18 additions and 6 deletions
22
sim_video.c
22
sim_video.c
|
@ -2146,10 +2146,16 @@ if (!filename)
|
||||||
return SCPE_MEM;
|
return SCPE_MEM;
|
||||||
#if SDL_MAJOR_VERSION == 1
|
#if SDL_MAJOR_VERSION == 1
|
||||||
#if defined(HAVE_LIBPNG)
|
#if defined(HAVE_LIBPNG)
|
||||||
sprintf (fullname, "%s.png", filename);
|
if (!match_ext (filename, "bmp")) {
|
||||||
stat = SDL_SavePNG(vid_image, fullname);
|
sprintf (fullname, "%s%s", filename, match_ext (filename, "png") ? "" : ".png");
|
||||||
|
stat = SDL_SavePNG(vid_image, fullname);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
sprintf (fullname, "%s", filename);
|
||||||
|
stat = SDL_SaveBMP(vid_image, fullname);
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
sprintf (fullname, "%s.bmp", filename);
|
sprintf (fullname, "%s%s", filename, match_ext (filename, "bmp") ? "" : ".bmp");
|
||||||
stat = SDL_SaveBMP(vid_image, fullname);
|
stat = SDL_SaveBMP(vid_image, fullname);
|
||||||
#endif /* defined(HAVE_LIBPNG) */
|
#endif /* defined(HAVE_LIBPNG) */
|
||||||
#else /* SDL_MAJOR_VERSION != 1 */
|
#else /* SDL_MAJOR_VERSION != 1 */
|
||||||
|
@ -2158,10 +2164,16 @@ if (1) {
|
||||||
SDL_CreateRGBSurface(0, vid_width, vid_height, 32, 0x0000ff00, 0x000ff000, 0xff000000, 0x000000ff) ;
|
SDL_CreateRGBSurface(0, vid_width, vid_height, 32, 0x0000ff00, 0x000ff000, 0xff000000, 0x000000ff) ;
|
||||||
SDL_RenderReadPixels(vid_renderer, NULL, SDL_PIXELFORMAT_ARGB8888, sshot->pixels, sshot->pitch);
|
SDL_RenderReadPixels(vid_renderer, NULL, SDL_PIXELFORMAT_ARGB8888, sshot->pixels, sshot->pitch);
|
||||||
#if defined(HAVE_LIBPNG)
|
#if defined(HAVE_LIBPNG)
|
||||||
sprintf (fullname, "%s.png", filename);
|
if (!match_ext (filename, "bmp")) {
|
||||||
|
sprintf (fullname, "%s%s", filename, match_ext (filename, "png") ? "" : ".png");
|
||||||
stat = SDL_SavePNG(sshot, fullname);
|
stat = SDL_SavePNG(sshot, fullname);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
sprintf (fullname, "%s", filename);
|
||||||
|
stat = SDL_SaveBMP(sshot, fullname);
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
sprintf (fullname, "%s.bmp", filename);
|
sprintf (fullname, "%s%s", filename, match_ext (filename, "bmp") ? "" : ".bmp");
|
||||||
stat = SDL_SaveBMP(sshot, fullname);
|
stat = SDL_SaveBMP(sshot, fullname);
|
||||||
#endif /* defined(HAVE_LIBPNG) */
|
#endif /* defined(HAVE_LIBPNG) */
|
||||||
SDL_FreeSurface(sshot);
|
SDL_FreeSurface(sshot);
|
||||||
|
|
Loading…
Add table
Reference in a new issue