shithub: choc

Download patch

ref: e334de61580e02c7fce892dd185b5c3fd7ff6e5d
parent: 9c2e7100d03892ca84959832e17c9a40d52048d1
parent: 76d72fc48dc88fac4faa8b0b3907679eb8555778
author: Mike Swanson <mikeonthecomputer@gmail.com>
date: Sun Aug 13 07:49:43 EDT 2017

Merge commit '76d72fc48dc88fac4faa8b0b3907679eb8555778' into sdl2-branch

--- a/src/v_video.c
+++ b/src/v_video.c
@@ -736,9 +736,17 @@
     int width, height;
     byte *rowbuf;
 
-    // scale up to accommodate aspect ratio correction
-    width = inwidth * 5;
-    height = inheight * 6;
+    if (aspect_ratio_correct)
+    {
+        // scale up to accommodate aspect ratio correction
+        width = inwidth * 5;
+        height = inheight * 6;
+    }
+    else
+    {
+        width = inwidth;
+        height = inheight;
+    }
 
     handle = fopen(filename, "wb");
     if (!handle)
@@ -792,17 +800,32 @@
 
     if (rowbuf)
     {
-        for (i = 0; i < SCREENHEIGHT; i++)
+        if (aspect_ratio_correct)
         {
-            // expand the row 5x
-            for (j = 0; j < SCREENWIDTH; j++)
+            for (i = 0; i < SCREENHEIGHT; i++)
             {
-                memset(rowbuf + j * 5, *(data + i*SCREENWIDTH + j), 5);
-            }
+                // expand the row 5x
+                for (j = 0; j < SCREENWIDTH; j++)
+                {
+                    memset(rowbuf + j * 5, *(data + i*SCREENWIDTH + j), 5);
+                }
 
-            // write the row 6 times
-            for (j = 0; j < 6; j++)
+                // write the row 6 times
+                for (j = 0; j < 6; j++)
+                {
+                    png_write_row(ppng, rowbuf);
+                }
+            }
+        }
+        else
+        {
+            for (i = 0; i < SCREENHEIGHT; i++)
             {
+                for (j = 0; j < SCREENWIDTH; j++)
+                {
+                    memset(rowbuf + j, *(data + i*SCREENWIDTH + j), 1);
+                }
+
                 png_write_row(ppng, rowbuf);
             }
         }