comparison src/video/bwindow/SDL_sysvideo.cc @ 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 2c835d58faad
comparison
equal deleted inserted replaced
2080:c611cb0638b2 2081:34a4d02b8db1
368 bscreen.GetMode(&current); 368 bscreen.GetMode(&current);
369 current_refresh = (1000 * current.timing.pixel_clock) / 369 current_refresh = (1000 * current.timing.pixel_clock) /
370 (current.timing.h_total * current.timing.v_total); 370 (current.timing.h_total * current.timing.v_total);
371 371
372 modes = SDL_modelist[((bpp + 7) / 8) - 1]; 372 modes = SDL_modelist[((bpp + 7) / 8) - 1];
373 for (i = 0; modes[i] && (modes[i]->w > width) && 373
374 (modes[i]->h > height); ++i) { 374 bool exactmatch = false;
375 /* still looking */ 375 for ( uint32 x = 0; modes[x]; x++ ) {
376 } 376 if (modes[x]->w == width && modes[x]->h == height) {
377 if (!modes[i] || (modes[i]->w < width) || (modes[i]->h < height)) { 377 exactmatch = true;
378 --i; /* We went too far */ 378 i = x;
379 break;
380 }
381 }
382 if (!exactmatch) {
383 for (i = 0; modes[i] && (modes[i]->w > width) &&
384 (modes[i]->h > height); ++i) {
385 /* still looking */
386 }
387 if (!modes[i] || (modes[i]->w < width) || (modes[i]->h < height)) {
388 --i; /* We went too far */
389 }
379 } 390 }
380 width = modes[i]->w; 391 width = modes[i]->w;
381 height = modes[i]->h; 392 height = modes[i]->h;
382 bscreen.GetModeList(&dmodes, &nmodes); 393 bscreen.GetModeList(&dmodes, &nmodes);
383 for (i = 0; i < nmodes; ++i) { 394 for (i = 0; i < nmodes; ++i) {