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
This commit is contained in:
svdijk 2013-03-02 18:10:19 +00:00
parent 587a35a1d0
commit d8938a0a7f

View file

@ -203,6 +203,11 @@ static qboolean VID_ValidMode (int width, int height, int bpp, qboolean fullscre
if (height < 200) if (height < 200)
return false; return false;
if (fullscreen)
flags |= SDL_FULLSCREEN;
bpp = SDL_VideoModeOK(width, height, bpp, flags);
switch (bpp) switch (bpp)
{ {
case 16: case 16:
@ -213,12 +218,6 @@ static qboolean VID_ValidMode (int width, int height, int bpp, qboolean fullscre
return false; return false;
} }
if (fullscreen)
flags |= SDL_FULLSCREEN;
if (!SDL_VideoModeOK(width, height, bpp, flags))
return false;
return true; 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) if (SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, (vid_vsync.value) ? 1 : 0) == -1)
gl_swap_control = false; gl_swap_control = false;
bpp = SDL_VideoModeOK(width, height, bpp, flags);
draw_context = SDL_SetVideoMode(width, height, bpp, flags); draw_context = SDL_SetVideoMode(width, height, bpp, flags);
if (!draw_context) if (!draw_context)
Sys_Error ("Couldn't set video mode"); Sys_Error ("Couldn't set video mode");