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 962

Summary: SDL_SetVideoMode returns a surface with wrong bpp
Product: SDL Reporter: Kalle Olavi Niemitalo <kon>
Component: videoAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: HG 2.0   
Hardware: x86_64   
OS: Linux   

Description Kalle Olavi Niemitalo 2010-02-28 10:33:45 UTC
Bos Wars requires SDL 1.2.  I patched it a bit and got it to build with SDL 1.3 SVN r5558, but there are problems.  One of them happens in boswars/engine/video/sdl.cpp (InitVideoSdl):

TheScreen = SDL_SetVideoMode(Video.Width, Video.Height, Video.Depth, flags);
if (TheScreen && (TheScreen->format->BitsPerPixel != 16 &&
TheScreen->format->BitsPerPixel != 32)) {
// Only support 16 and 32 bpp, default to 16
TheScreen = SDL_SetVideoMode(Video.Width, Video.Height, 16, flags);
}

This is supposed to get a video mode with 16 or 32 bpp.  However, what happens is the first SDL_SetVideoMode call returns a surface with 24 bpp, and when Bos Wars tries to change it to 16 bpp, the second call again returns 24 bpp!  If I run Bos Wars with -D 16 or -D 32, so that the bpp in the first SDL_SetVideoMode call is 16 or 32 rather than 0, then it returns a surface with the correct bpp.

The bug seems to be that SDL_SetVideoMode first tries SDL_ResizeVideoMode and passes the bpp parameter to that, but SDL_ResizeVideoMode totally ignores the parameter.
Comment 1 Sam Lantinga 2011-02-16 03:45:09 UTC
This should be fixed in the latest snapshot:
http://www.libsdl.org/tmp/SDL-1.3.zip

Thanks!