Skip to content

Commit

Permalink
Fix loading of PNG resources on big-endian machines
Browse files Browse the repository at this point in the history
LodePNG always loads PNG in big-endian RGBA format. For this reason,
when loading PNG files VVVVVV was specifying the format as ABGR and the
conversion would then be performed by SDL. However, then running on
big-endian machines, this conversion should not be performed at all, and
the surface format should then be set to RGBA.
  • Loading branch information
mardy authored and flibitijibibo committed Jan 22, 2024
1 parent 32e6ab6 commit b5abc39
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions desktop_version/src/GraphicsResources.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@ static SDL_Surface* LoadImageRaw(const char* filename, unsigned char** data)
height,
32,
width * 4,
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
SDL_PIXELFORMAT_RGBA8888
#else
SDL_PIXELFORMAT_ABGR8888
#endif
);

return loadedImage;
Expand Down

0 comments on commit b5abc39

Please sign in to comment.