From d386a1611a96cead7e2e03eb9941d3ad6076f419 Mon Sep 17 00:00:00 2001 From: Alberto Mardegan Date: Mon, 22 Jan 2024 18:32:15 +0300 Subject: [PATCH] Fix loading of PNG resources on big-endian machines 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. --- desktop_version/src/GraphicsResources.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/desktop_version/src/GraphicsResources.cpp b/desktop_version/src/GraphicsResources.cpp index 3ea8f090..571a1f00 100644 --- a/desktop_version/src/GraphicsResources.cpp +++ b/desktop_version/src/GraphicsResources.cpp @@ -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;