Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Look for an exact match first when setting a video mode on BeOS.
  Fixes Bugzilla #370.
  • Loading branch information
icculus committed Dec 8, 2006
1 parent 3b8aefc commit 080afb7
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions src/video/bwindow/SDL_sysvideo.cc
Expand Up @@ -370,12 +370,23 @@ extern "C"
(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;
Expand Down

0 comments on commit 080afb7

Please sign in to comment.