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 798 - Failure to select correct fullscreen mode: 1.2.13 & SVN 1.3
Summary: Failure to select correct fullscreen mode: 1.2.13 & SVN 1.3
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: HG 1.2
Hardware: Other BeOS
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-09-19 14:19 UTC by kty
Modified: 2009-10-09 19:11 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description kty 2009-09-19 14:19:04 UTC
The stable release of SDL 1.2.13 for BeOS/Haiku has a bug in BE_FindClosestFSMode that causes it to sometimes not select the best mode when going fullscreen. There are in fact two bugs in the implementation but I will not go into specifics because there is already a patch for it in the developer SVN 1.3. However I am still reporting it because I believe the following code is a better patch for the issue. The current implementation on SVN only works if it is able to find an exact match for the requested mode. However, by scanning from lowest-to-highest resolution instead of highest-to-lowest, one can find the best mode at all times:

(this code is intended to go in /src/video/bwindow/SDL_sysvideo.cc, around line  360 for stable 1.2.13 and line 372 for the latest pull of SVN 1.3).

<--snip-->
modes = SDL_modelist[((bpp+7)/8)-1];
	
	// find end of list (lowest-resolution mode; modes are ordered
	// highest-to-lowest).
	i = 0; while(modes[i]) i++;
	if (!i) return false;		// what? no modes at all?
	
	// find first mode with resolution >= requested in both dimensions
	for (--i; i >= 0; --i)
	{
		if (modes[i]->w >= width && modes[i]->h >= height)
			break;
	}
	
	// unable to find any mode with that high a resolution!
	if (i < 0)
		return false;
	
	width = modes[i]->w;
	height = modes[i]->h;
<--snip-->
Comment 1 Scott McCreary 2009-10-09 12:46:59 UTC
kty@lavabit.com's patch has been added into another bwindow related patch by Bruno Albuquerque (bga) and checked into HaikuPorts svn:
http://ports.haiku-files.org/browser/haikuports/trunk/media-libs/libsdl/sdl-1.2-svn-4901-haiku.diff
There's a link at the bottom of that page to get the plain text version for applying. This is the same patch I emailed a few days ago, just following up here in case it got lost in the email.
There's still some quirkiness to the saving and restoring of the previous video mode, but this is a step in the right direction.
-scottmc
Comment 2 Sam Lantinga 2009-10-09 19:11:24 UTC
This is in for the next release, thanks!