- 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.

This commit is contained in:
Christoph Oelckers 2018-07-22 11:40:12 +02:00
parent 6d0b172762
commit d84497c85a
2 changed files with 3 additions and 2 deletions

View file

@ -163,6 +163,8 @@ void OpenGLFrameBuffer::Update()
int initialHeight = GetClientHeight(); int initialHeight = GetClientHeight();
int clientWidth = ViewportScaledWidth(initialWidth, initialHeight); int clientWidth = ViewportScaledWidth(initialWidth, initialHeight);
int clientHeight = ViewportScaledHeight(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)) if (clientWidth > 0 && clientHeight > 0 && (GetWidth() != clientWidth || GetHeight() != clientHeight))
{ {
SetVirtualSize(clientWidth, clientHeight); SetVirtualSize(clientWidth, clientHeight);

View file

@ -475,8 +475,7 @@ void V_UpdateModeSize (int width, int height)
CleanWidth = width / CleanXfac; CleanWidth = width / CleanXfac;
CleanHeight = height / CleanYfac; CleanHeight = height / CleanYfac;
assert(CleanWidth >= 320); assert(CleanWidth >= 320 && CleanHeight >= 200);
assert(CleanHeight >= 200);
if (width < 800 || width >= 960) if (width < 800 || width >= 960)
{ {