From d84497c85a27d419a183752100f4d4dd67d1869b Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 22 Jul 2018 11:40:12 +0200 Subject: [PATCH] - don't let the video scale let the screen end up with a client size less than 320x200, which may cause undefined behavior and trigger asserts in debug builds. --- src/gl/system/gl_framebuffer.cpp | 2 ++ src/v_video.cpp | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gl/system/gl_framebuffer.cpp b/src/gl/system/gl_framebuffer.cpp index 0cfdc1ad1a..ef35b5584c 100644 --- a/src/gl/system/gl_framebuffer.cpp +++ b/src/gl/system/gl_framebuffer.cpp @@ -163,6 +163,8 @@ void OpenGLFrameBuffer::Update() int initialHeight = GetClientHeight(); int clientWidth = ViewportScaledWidth(initialWidth, initialHeight); int clientHeight = ViewportScaledHeight(initialWidth, initialHeight); + if (clientWidth < 320) clientWidth = 320; + if (clientHeight < 200) clientHeight = 200; if (clientWidth > 0 && clientHeight > 0 && (GetWidth() != clientWidth || GetHeight() != clientHeight)) { SetVirtualSize(clientWidth, clientHeight); diff --git a/src/v_video.cpp b/src/v_video.cpp index 77d13d1a9d..df6a86ccfd 100644 --- a/src/v_video.cpp +++ b/src/v_video.cpp @@ -475,8 +475,7 @@ void V_UpdateModeSize (int width, int height) CleanWidth = width / CleanXfac; CleanHeight = height / CleanYfac; - assert(CleanWidth >= 320); - assert(CleanHeight >= 200); + assert(CleanWidth >= 320 && CleanHeight >= 200); if (width < 800 || width >= 960) {