changeset 2081:34a4d02b8db1

Look for an exact match first when setting a video mode on BeOS. Fixes Bugzilla #370.
author Ryan C. Gordon <icculus@icculus.org>
date Fri, 08 Dec 2006 00:31:32 +0000
parents c611cb0638b2
children e6cd882e3ac0
files src/video/bwindow/SDL_sysvideo.cc
diffstat 1 files changed, 16 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/video/bwindow/SDL_sysvideo.cc	Fri Dec 08 00:16:38 2006 +0000
+++ b/src/video/bwindow/SDL_sysvideo.cc	Fri Dec 08 00:31:32 2006 +0000
@@ -370,12 +370,23 @@
             (current.timing.h_total * current.timing.v_total);
 
         modes = SDL_modelist[((bpp + 7) / 8) - 1];
-        for (i = 0; modes[i] && (modes[i]->w > width) &&
-             (modes[i]->h > height); ++i) {
-            /* still looking */
+
+        bool exactmatch = false;
+        for ( uint32 x = 0; modes[x]; x++ ) {
+            if (modes[x]->w == width && modes[x]->h == height) {
+                exactmatch = true;
+                i = x;
+                break;
+            }
         }
-        if (!modes[i] || (modes[i]->w < width) || (modes[i]->h < height)) {
-            --i;                /* We went too far */
+        if (!exactmatch) {
+            for (i = 0; modes[i] && (modes[i]->w > width) &&
+                 (modes[i]->h > height); ++i) {
+                /* still looking */
+            }
+            if (!modes[i] || (modes[i]->w < width) || (modes[i]->h < height)) {
+                --i;                /* We went too far */
+            }
         }
         width = modes[i]->w;
         height = modes[i]->h;