Commit fa3a55a9 authored by Sam Lantinga's avatar Sam Lantinga

Don't allow video modes larger than the maximum size

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40854
parent fb965d4e
...@@ -359,6 +359,13 @@ static Uint8 SDL_closest_depths[4][8] = { ...@@ -359,6 +359,13 @@ static Uint8 SDL_closest_depths[4][8] = {
{ 0, 32, 16, 15, 24, 8, 0, 0 } { 0, 32, 16, 15, 24, 8, 0, 0 }
}; };
#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 SDL_VideoModeOK (int width, int height, int bpp, Uint32 flags)
{ {
int table, b, i; int table, b, i;
...@@ -387,15 +394,18 @@ int SDL_VideoModeOK (int width, int height, int bpp, Uint32 flags) ...@@ -387,15 +394,18 @@ int SDL_VideoModeOK (int width, int height, int bpp, Uint32 flags)
/* No sizes supported at this bit-depth */ /* No sizes supported at this bit-depth */
continue; continue;
} else } else
#ifdef macintosh /* MPW optimization bug? */ if (sizes == (SDL_Rect **)NEGATIVE_ONE) {
if ( (sizes == (SDL_Rect **)0xFFFFFFFF) ||
#else
if ( (sizes == (SDL_Rect **)-1) ||
#endif
current_video->handles_any_size ) {
/* Any size supported at this bit-depth */ /* Any size supported at this bit-depth */
supported = 1; supported = 1;
continue; 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 } else
for ( i=0; sizes[i]; ++i ) { for ( i=0; sizes[i]; ++i ) {
if ((sizes[i]->w == width) && (sizes[i]->h == height)) { if ((sizes[i]->w == width) && (sizes[i]->h == height)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment