1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-02 16:38:41 +00:00

Fix rendering regression with TGA type 1 files with BGRA8 color (#15402)

TGA uses BGR(A)8, stored in memory in that order. Irrlicht typically expects 0xAARRGGBB, which depends on endianness.
(This means that on little endian, no [B][G][R][A] -> 0xAARRGGBB conversion needs to be done, but Irrlicht was swapping the bytes.)

This makes both conversion functions consistently convert from [B][G][R]([A]) to 0xAARRGGBB (SColor), documents them properly and moves them to CImageLoaderTGA.cpp
so no poor soul shall be fooled by them in the near future.

---------

Co-authored-by: Ælla Chiana Moskopp <erle@dieweltistgarnichtso.net>
This commit is contained in:
Lars Müller 2024-11-19 13:37:05 +01:00 committed by GitHub
parent 138052adfc
commit 15e8f9e6a0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 32 additions and 33 deletions

View file

@ -66,8 +66,6 @@ public:
static void convert_R8G8B8toA1R5G5B5(const void *sP, s32 sN, void *dP);
static void convert_R8G8B8toB8G8R8(const void *sP, s32 sN, void *dP);
static void convert_R8G8B8toR5G6B5(const void *sP, s32 sN, void *dP);
static void convert_B8G8R8toA8R8G8B8(const void *sP, s32 sN, void *dP);
static void convert_B8G8R8A8toA8R8G8B8(const void *sP, s32 sN, void *dP);
static void convert_A8R8G8B8toR8G8B8A8(const void *sP, s32 sN, void *dP);
static void convert_A8R8G8B8toA8B8G8R8(const void *sP, s32 sN, void *dP);