Fixed bug #605, per Martin's suggestion
authorSam Lantinga <slouken@libsdl.org>
Tue, 25 Nov 2008 20:06:27 +0000
changeset 2789 985001797115
parent 2788 44be910366a9
child 2790 8c9fa61a521c
Fixed bug #605, per Martin's suggestion
src/video/SDL_video.c
--- 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;