Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDL_SetVideoMode returns a surface with wrong bpp #267

Closed
SDLBugzilla opened this issue Feb 10, 2021 · 0 comments
Closed

SDL_SetVideoMode returns a surface with wrong bpp #267

SDLBugzilla opened this issue Feb 10, 2021 · 0 comments

Comments

@SDLBugzilla
Copy link
Collaborator

This bug report was migrated from our old Bugzilla tracker.

Reported in version: HG 2.0
Reported for operating system, platform: Linux, x86_64

Comments on the original bug report:

On 2010-02-28 10:33:45 +0000, Kalle Olavi Niemitalo wrote:

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.

On 2011-02-16 03:45:09 +0000, Sam Lantinga wrote:

This should be fixed in the latest snapshot:
http://www.libsdl.org/tmp/SDL-1.3.zip

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant