mirror of
https://github.com/Redot-Engine/redot-engine.git
synced 2025-12-06 15:21:56 -05:00
Fix TGA indexed images loaded with flipped color table
This fixes incorrect color table lookup where red and blue channels were flipped.
(cherry picked from commit d0f0f1f1cb)
This commit is contained in:
committed by
Rémi Verschelde
parent
660acc3913
commit
f6c0078264
@@ -148,9 +148,11 @@ Error ImageLoaderTGA::convert_to_image(Ref<Image> p_image, const uint8_t *p_buff
|
|||||||
uint8_t a = 0xff;
|
uint8_t a = 0xff;
|
||||||
|
|
||||||
if (p_header.color_map_depth == 24) {
|
if (p_header.color_map_depth == 24) {
|
||||||
r = (p_palette[(index * 3) + 0]);
|
// Due to low-high byte order, the color table must be
|
||||||
|
// read in the same order as image data (little endian)
|
||||||
|
r = (p_palette[(index * 3) + 2]);
|
||||||
g = (p_palette[(index * 3) + 1]);
|
g = (p_palette[(index * 3) + 1]);
|
||||||
b = (p_palette[(index * 3) + 2]);
|
b = (p_palette[(index * 3) + 0]);
|
||||||
} else {
|
} else {
|
||||||
return ERR_INVALID_DATA;
|
return ERR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user