From 39969245f8613a8af6eff6aa41bb0d2ed1ddff22 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 25 Nov 2008 20:06:27 +0000 Subject: [PATCH] Fixed bug #605, per Martin's suggestion --HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403250 --- src/video/SDL_video.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index 28eade9a0..2cc979e12 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -488,11 +488,20 @@ SDL_GetClosestDisplayMode(const SDL_DisplayMode * mode, 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;