foxygit / doom Log in
commit 901ee2fe7588fd9dbe62f40b187bcaf364c0fce1
Author:     Fabian Greffrath <fabian@greffrath.com>
AuthorDate: Thu May 5 14:53:03 2016 +0200
Commit:     Fabian Greffrath <fabian@greffrath.com>
CommitDate: Thu May 5 14:53:03 2016 +0200

    consider aspect_ratio_correct when saving PNG screenshot
---
 src/i_video.c | 27 +++++++++++++++++----------
 1 file changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/i_video.c b/src/i_video.c
index a7518c82..a47eba7e 100644
--- a/src/i_video.c
+++ b/src/i_video.c
@@ -1222,17 +1222,24 @@ void I_BindVideoVariables(void)

 void I_SavePNGScreenshot (char *filename)
 {
-    const int width = 1600, height = 1200;
-    SDL_Surface *shotbuffer;
+    if (aspect_ratio_correct)
+    {
+        const int width = 1600, height = 1200;
+        SDL_Surface *shotbuffer;

-    shotbuffer = SDL_CreateRGBSurface(0, width, height, 32,
-                                      0x00ff0000,
-                                      0x0000ff00,
-                                      0x000000ff,
-                                      0xff000000);
+        shotbuffer = SDL_CreateRGBSurface(0, width, height, 32,
+                                          0x00ff0000,
+                                          0x0000ff00,
+                                          0x000000ff,
+                                          0xff000000);

-    SDL_BlitScaled(rgbabuffer, NULL, shotbuffer, NULL);
-    IMG_SavePNG(shotbuffer, filename);
+        SDL_BlitScaled(rgbabuffer, NULL, shotbuffer, NULL);
+        IMG_SavePNG(shotbuffer, filename);

-    SDL_FreeSurface(shotbuffer);
+        SDL_FreeSurface(shotbuffer);
+    }
+    else
+    {
+        IMG_SavePNG(rgbabuffer, filename);
+    }
 }