From d8938a0a7f6c6e0308b83aa34d7b2489f21ee6bd Mon Sep 17 00:00:00 2001 From: svdijk Date: Sat, 2 Mar 2013 18:10:19 +0000 Subject: [PATCH] gl_vidsdl.c: be bit more lenient (and safer) regarding bpp git-svn-id: svn+ssh://svn.code.sf.net/p/quakespasm/code/trunk@836 af15c1b1-3010-417e-b628-4374ebc0bcbd --- quakespasm/Quake/gl_vidsdl.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/quakespasm/Quake/gl_vidsdl.c b/quakespasm/Quake/gl_vidsdl.c index 8afba7bf..087bff7f 100644 --- a/quakespasm/Quake/gl_vidsdl.c +++ b/quakespasm/Quake/gl_vidsdl.c @@ -203,6 +203,11 @@ static qboolean VID_ValidMode (int width, int height, int bpp, qboolean fullscre if (height < 200) return false; + if (fullscreen) + flags |= SDL_FULLSCREEN; + + bpp = SDL_VideoModeOK(width, height, bpp, flags); + switch (bpp) { case 16: @@ -213,12 +218,6 @@ static qboolean VID_ValidMode (int width, int height, int bpp, qboolean fullscre return false; } - if (fullscreen) - flags |= SDL_FULLSCREEN; - - if (!SDL_VideoModeOK(width, height, bpp, flags)) - return false; - return true; } @@ -250,6 +249,8 @@ static int VID_SetMode (int width, int height, int bpp, qboolean fullscreen) if (SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, (vid_vsync.value) ? 1 : 0) == -1) gl_swap_control = false; + bpp = SDL_VideoModeOK(width, height, bpp, flags); + draw_context = SDL_SetVideoMode(width, height, bpp, flags); if (!draw_context) Sys_Error ("Couldn't set video mode");