| Summary: | SDL_SetVideoMode returns a surface with wrong bpp | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Kalle Olavi Niemitalo <kon> |
| Component: | video | Assignee: | Sam Lantinga <slouken> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | ||
| Version: | HG 2.0 | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
This should be fixed in the latest snapshot: http://www.libsdl.org/tmp/SDL-1.3.zip Thanks! |
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.