diff src/video/SDL_video.c @ 2789:985001797115

Fixed bug #605, per Martin's suggestion
author Sam Lantinga <slouken@libsdl.org>
date Tue, 25 Nov 2008 20:06:27 +0000
parents 93764fe8601a
children 27cb878a278e
line wrap: on
line diff
--- a/src/video/SDL_video.c	Tue Nov 25 08:40:52 2008 +0000
+++ b/src/video/SDL_video.c	Tue Nov 25 20:06:27 2008 +0000
@@ -488,11 +488,20 @@
     for (i = 0; i < SDL_GetNumDisplayModes(); ++i) {
         current = &SDL_CurrentDisplay.display_modes[i];
 
-        if ((current->w && current->h) &&
-            (current->w < mode->w || current->h < mode->h)) {
+        if (current->w && (current->w < mode->w)) {
             /* Out of sorted modes large enough here */
             break;
         }
+        if (current->h && (current->h < mode->h)) {
+            if (current->w && (current->w == mode->w)) {
+                /* Out of sorted modes large enough here */
+                break;
+            }
+            /* Wider, but not tall enough, due to a different
+               aspect ratio. This mode must be skipped, but closer
+               modes may still follow. */
+            continue;
+        }
         if (!match || current->w < match->w || current->h < match->h) {
             match = current;
             continue;