# HG changeset patch # User Sam Lantinga # Date 1077608539 0 # Node ID dddfc37e1f65453ad7768a4d3bd4ce4bf6cbe8b3 # Parent 2651b6b43840651d3629c420f9a5e4bc5b69d4aa Don't allow video modes larger than the maximum size diff -r 2651b6b43840 -r dddfc37e1f65 src/video/SDL_video.c --- a/src/video/SDL_video.c Tue Feb 24 06:53:22 2004 +0000 +++ b/src/video/SDL_video.c Tue Feb 24 07:42:19 2004 +0000 @@ -359,7 +359,14 @@ { 0, 32, 16, 15, 24, 8, 0, 0 } }; -int SDL_VideoModeOK (int width, int height, int bpp, Uint32 flags) + +#ifdef macintosh /* MPW optimization bug? */ +#define NEGATIVE_ONE 0xFFFFFFFF +#else +#define NEGATIVE_ONE -1 +#endif + +int SDL_VideoModeOK (int width, int height, int bpp, Uint32 flags) { int table, b, i; int supported; @@ -387,15 +394,18 @@ /* No sizes supported at this bit-depth */ continue; } else -#ifdef macintosh /* MPW optimization bug? */ - if ( (sizes == (SDL_Rect **)0xFFFFFFFF) || -#else - if ( (sizes == (SDL_Rect **)-1) || -#endif - current_video->handles_any_size ) { + if (sizes == (SDL_Rect **)NEGATIVE_ONE) { /* Any size supported at this bit-depth */ supported = 1; continue; + } else if (current_video->handles_any_size) { + /* Driver can center a smaller surface to simulate fullscreen */ + for ( i=0; sizes[i]; ++i ) { + if ((sizes[i]->w >= width) && (sizes[i]->h >= height)) { + supported = 1; /* this mode can fit the centered window. */ + break; + } + } } else for ( i=0; sizes[i]; ++i ) { if ((sizes[i]->w == width) && (sizes[i]->h == height)) {