diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/v_video.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/v_video.c b/src/v_video.c index 60817086..4f38c5c3 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -738,12 +738,16 @@ void WritePNGfile(char *filename, byte *data, handle = fopen(filename, "wb"); if (!handle) + { return; + } ppng = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, error_fn, warning_fn); if (!ppng) + { return; + } pinfo = png_create_info_struct(ppng); if (!pinfo) @@ -778,7 +782,9 @@ void WritePNGfile(char *filename, byte *data, png_write_info(ppng, pinfo); for (i = 0; i < SCREENHEIGHT; i++) + { png_write_row(ppng, data + i*SCREENWIDTH); + } png_write_end(ppng, pinfo); png_destroy_write_struct(&ppng, &pinfo); @@ -801,10 +807,14 @@ void V_ScreenShot(char *format) #ifdef HAVE_LIBPNG if (png_screenshots) + { ext = "png"; + } else #endif + { ext = "pcx"; + } for (i=0; i<=99; i++) { @@ -823,15 +833,19 @@ void V_ScreenShot(char *format) #ifdef HAVE_LIBPNG if (png_screenshots) + { WritePNGfile(lbmname, I_VideoBuffer, SCREENWIDTH, SCREENHEIGHT, W_CacheLumpName (DEH_String("PLAYPAL"), PU_CACHE)); + } else #endif + { // save the pcx file WritePCXfile(lbmname, I_VideoBuffer, SCREENWIDTH, SCREENHEIGHT, W_CacheLumpName (DEH_String("PLAYPAL"), PU_CACHE)); + } } #define MOUSE_SPEED_BOX_WIDTH 120 |