mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2024-11-27 22:22:08 +00:00
Fix minimize crash
This commit is contained in:
parent
dc39a006dc
commit
5f02e08c8e
2 changed files with 9 additions and 0 deletions
|
@ -444,6 +444,8 @@ void FGLRenderer::ClearBorders()
|
|||
|
||||
int clientWidth = framebuffer->GetClientWidth();
|
||||
int clientHeight = framebuffer->GetClientHeight();
|
||||
if (clientWidth == 0 || clientHeight == 0)
|
||||
return;
|
||||
|
||||
glViewport(0, 0, clientWidth, clientHeight);
|
||||
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
|
|
|
@ -231,6 +231,13 @@ void FGLRenderer::SetOutputViewport(GL_IRECT *bounds)
|
|||
// Back buffer letterbox for the final output
|
||||
int clientWidth = framebuffer->GetClientWidth();
|
||||
int clientHeight = framebuffer->GetClientHeight();
|
||||
if (clientWidth == 0 || clientHeight == 0)
|
||||
{
|
||||
// When window is minimized there may not be any client area.
|
||||
// Pretend to the rest of the render code that we just have a very small window.
|
||||
clientWidth = 160;
|
||||
clientHeight = 120;
|
||||
}
|
||||
int screenWidth = framebuffer->GetWidth();
|
||||
int screenHeight = framebuffer->GetHeight();
|
||||
float scale = MIN(clientWidth / (float)screenWidth, clientHeight / (float)screenHeight);
|
||||
|
|
Loading…
Reference in a new issue