Changeset - r23882:d683a0787bc9
[Not reviewed]
master
0 1 0
Nikolas Nyby - 5 years ago 2019-10-22 15:17:00
nikolas@gnu.org
Codechange: Don't use SDL_CreateRGBSurfaceWithFormat()

This function requires libSDL 2.0.5 or higher. It looks like we don't
need to use it, and can just use the original SDL_CreateRGBSurface(),
with the masks set to 0, to trigger the default 8-bit format, which is
SDL_PIXELFORMAT_INDEX8.

Closes #7785

Note: this code path is activated by using an 8-bit blitter, like:

./bin/openttd -b 8bpp-simple
1 file changed with 1 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/video/sdl2_v.cpp
Show inline comments
 
@@ -304,13 +304,13 @@ bool VideoDriver_SDL::CreateMainSurface(
 
		return false;
 
	}
 

	
 
	_sdl_realscreen = newscreen;
 

	
 
	if (bpp == 8) {
 
		newscreen = SDL_CreateRGBSurfaceWithFormat(0, w, h, 8, SDL_PIXELFORMAT_INDEX8);
 
		newscreen = SDL_CreateRGBSurface(0, w, h, 8, 0, 0, 0, 0);
 

	
 
		if (newscreen == nullptr) {
 
			DEBUG(driver, 0, "SDL2: Couldn't allocate shadow surface: %s", SDL_GetError());
 
			return false;
 
		}
 
	}
0 comments (0 inline, 0 general)