We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 370

Summary: fullscreen support on beos isn't finding the closest mode
Product: SDL Reporter: Chris Roberts <cpr420>
Component: videoAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: 1.2.11   
Hardware: Other   
OS: BeOS   
Attachments: applies the fixes listed in the comments

Description Chris Roberts 2006-12-07 18:42:30 UTC
There are two problems in BE_FindClosestFSMode.


1) in one of the if statements height is being compared against width

if ( ! modes[i] || (modes[i]->w < width) || (modes[i]->h < width) ) {

should be:

if ( ! modes[i] || (modes[i]->w < width) || (modes[i]->h < height) ) {



2) the mode list needs to be looped through to find an exact match before proceeding to search for the next closest match.

for ( i=0; modes[i] && (modes[i]->w > width) &&
        (modes[i]->h > height); ++i ) {
        /* still looking */
}

should be:

        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 ( ! exactmatch ) {
                for ( i=0; modes[i] && (modes[i]->w > width) &&
                        (modes[i]->h > height); ++i ) {
                        /* still looking */
                }
        }


There may be a better(more elegant) solution, but, this solves the problems.
Comment 1 Chris Roberts 2006-12-07 18:43:15 UTC
Created attachment 184 [details]
applies the fixes listed in the comments
Comment 2 Ryan C. Gordon 2006-12-07 19:46:07 UTC
I've updated your patch for the latest in source control and applied it.

Part 1 is fixed in Subversion revision #2924, and Part 2 is fixed in revision #2925.

Thanks!

--ryan.

Comment 3 Chris Roberts 2006-12-07 19:57:13 UTC
Damn, that was fast. You're setting the bar pretty high for other projects ;)

Thanks,
Chris