From 18f0f6be4b150ce609951994142e1959e848e04e Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Sun, 23 Jul 2017 17:26:55 +0200 Subject: [PATCH] - Pixel stretch for 320x200 and 640x400 in glswfb --- src/gl/system/gl_swframebuffer.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/gl/system/gl_swframebuffer.cpp b/src/gl/system/gl_swframebuffer.cpp index 6a9a92172..e80a0c7a5 100644 --- a/src/gl/system/gl_swframebuffer.cpp +++ b/src/gl/system/gl_swframebuffer.cpp @@ -93,6 +93,7 @@ EXTERN_CVAR(Bool, vid_vsync) EXTERN_CVAR(Float, transsouls) EXTERN_CVAR(Int, vid_refreshrate) EXTERN_CVAR(Bool, gl_legacy_mode) +EXTERN_CVAR(Int, vid_scalemode) extern bool bSuperSampled; @@ -727,9 +728,20 @@ void OpenGLSWFrameBuffer::Present() glBindFramebuffer(GL_FRAMEBUFFER, 0); glViewport(0, 0, clientWidth, clientHeight); - float scale = MIN(clientWidth / (float)Width, clientHeight / (float)Height); - int letterboxWidth = (int)round(Width * scale); - int letterboxHeight = (int)round(Height * scale); + float scaleX, scaleY; + if (vid_scalemode == 1 || vid_scalemode == 2) + { + scaleX = MIN(clientWidth / (float)Width, clientHeight / (Height * 1.2f)); + scaleY = scaleX * 1.2f; + } + else + { + scaleX = MIN(clientWidth / (float)Width, clientHeight / (float)Height); + scaleY = scaleX; + } + + int letterboxWidth = (int)round(Width * scaleX); + int letterboxHeight = (int)round(Height * scaleY); int letterboxX = (clientWidth - letterboxWidth) / 2; int letterboxY = (clientHeight - letterboxHeight) / 2;