Mercurial > sdl-ios-xcode
comparison src/video/SDL_video.c @ 853:dddfc37e1f65
Don't allow video modes larger than the maximum size
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Tue, 24 Feb 2004 07:42:19 +0000 |
parents | b8d311d90021 |
children | 50f5a29c6a17 |
comparison
equal
deleted
inserted
replaced
852:2651b6b43840 | 853:dddfc37e1f65 |
---|---|
357 { 0, 24, 32, 16, 15, 8, 0, 0 }, | 357 { 0, 24, 32, 16, 15, 8, 0, 0 }, |
358 /* 32 bit closest depth ordering */ | 358 /* 32 bit closest depth ordering */ |
359 { 0, 32, 16, 15, 24, 8, 0, 0 } | 359 { 0, 32, 16, 15, 24, 8, 0, 0 } |
360 }; | 360 }; |
361 | 361 |
362 int SDL_VideoModeOK (int width, int height, int bpp, Uint32 flags) | 362 |
363 #ifdef macintosh /* MPW optimization bug? */ | |
364 #define NEGATIVE_ONE 0xFFFFFFFF | |
365 #else | |
366 #define NEGATIVE_ONE -1 | |
367 #endif | |
368 | |
369 int SDL_VideoModeOK (int width, int height, int bpp, Uint32 flags) | |
363 { | 370 { |
364 int table, b, i; | 371 int table, b, i; |
365 int supported; | 372 int supported; |
366 SDL_PixelFormat format; | 373 SDL_PixelFormat format; |
367 SDL_Rect **sizes; | 374 SDL_Rect **sizes; |
385 sizes = SDL_ListModes(&format, flags); | 392 sizes = SDL_ListModes(&format, flags); |
386 if ( sizes == (SDL_Rect **)0 ) { | 393 if ( sizes == (SDL_Rect **)0 ) { |
387 /* No sizes supported at this bit-depth */ | 394 /* No sizes supported at this bit-depth */ |
388 continue; | 395 continue; |
389 } else | 396 } else |
390 #ifdef macintosh /* MPW optimization bug? */ | 397 if (sizes == (SDL_Rect **)NEGATIVE_ONE) { |
391 if ( (sizes == (SDL_Rect **)0xFFFFFFFF) || | |
392 #else | |
393 if ( (sizes == (SDL_Rect **)-1) || | |
394 #endif | |
395 current_video->handles_any_size ) { | |
396 /* Any size supported at this bit-depth */ | 398 /* Any size supported at this bit-depth */ |
397 supported = 1; | 399 supported = 1; |
398 continue; | 400 continue; |
401 } else if (current_video->handles_any_size) { | |
402 /* Driver can center a smaller surface to simulate fullscreen */ | |
403 for ( i=0; sizes[i]; ++i ) { | |
404 if ((sizes[i]->w >= width) && (sizes[i]->h >= height)) { | |
405 supported = 1; /* this mode can fit the centered window. */ | |
406 break; | |
407 } | |
408 } | |
399 } else | 409 } else |
400 for ( i=0; sizes[i]; ++i ) { | 410 for ( i=0; sizes[i]; ++i ) { |
401 if ((sizes[i]->w == width) && (sizes[i]->h == height)) { | 411 if ((sizes[i]->w == width) && (sizes[i]->h == height)) { |
402 supported = 1; | 412 supported = 1; |
403 break; | 413 break; |