shithub: choc

Download patch

ref: 2cc60a0d434c7c7df19cf9d65ec9ed389bc5cb58
parent: 075ca5a7617457cb189fcd5ba071dc38b9067582
author: Simon Howard <[email protected]>
date: Tue May 31 21:07:11 EDT 2016

video: Fix rounding up of window_height adjust.

The correct behavior here is to round up to the nearest pixel; the past
logic mostly worked but wasn't quite correct.

--- a/src/i_video.c
+++ b/src/i_video.c
@@ -287,9 +287,9 @@
 
     if (window_width * h <= window_height * SCREENWIDTH)
     {
-        // The +1 here stops us from repeatedly shrinking the screen size
-        // with each call.
-        window_height = (window_width + 1) * h / SCREENWIDTH;
+        // We round up window_height if the ratio is not exact; this leaves
+        // the result stable.
+        window_height = (window_width * h + SCREENWIDTH - 1) / SCREENWIDTH;
     }
     else
     {