Fix surface color masks

This fixes the color ordering of every SDL_Surface in the game.

Basically, images need to be loaded in ABGR format (except if they don't
have alpha, then you use RGB? I'm not sure what's going on here), and
then they will be converted to RGB/RGBA afterwards.

Due to the surfaces actually being BGR/BGRA, the game used to use
getRGBA/getRGB to swap the colors back around to BGRA/BGR, but I've
fixed those too.
This commit is contained in:
Misa
2021-02-18 22:20:11 -08:00
parent 2c0d6920e8
commit 37b7615b71
3 changed files with 7 additions and 13 deletions

View File

@@ -135,16 +135,13 @@ void Screen::LoadIcon(void)
FILESYSTEM_loadAssetToMemory("VVVVVV.png", &fileIn, &length, false);
lodepng_decode24(&data, &width, &height, fileIn, length);
FILESYSTEM_freeMemory(&fileIn);
SDL_Surface *icon = SDL_CreateRGBSurfaceFrom(
SDL_Surface *icon = SDL_CreateRGBSurfaceWithFormatFrom(
data,
width,
height,
24,
width * 3,
0x000000FF,
0x0000FF00,
0x00FF0000,
0x00000000
SDL_PIXELFORMAT_RGB24
);
SDL_SetWindowIcon(m_window, icon);
SDL_FreeSurface(icon);