engine: common: imagelib: fix incorrect check for big endian pixel formats

This commit is contained in:
Alibek Omarov
2025-12-13 22:30:03 +05:00
parent 837bf652c5
commit e2835a7614
2 changed files with 3 additions and 2 deletions

View File

@@ -23,6 +23,7 @@ NOTE: number at end of pixelformat name it's a total bitscount e.g. PF_RGB_24 ==
|| type == PF_BC7_UNORM \
|| type == PF_BC7_SRGB \
|| type == PF_KTX2_RAW )
#define ImageBigEndian( type ) ( type == PF_BGRA_32 || type == PF_BGR_24 )
typedef enum
{

View File

@@ -440,8 +440,8 @@ qboolean Image_SaveBMP( const char *name, rgbdata_t *pix )
else
{
// 24 bit
qboolean be = !!( pix->type & (PF_BGR_24|PF_BGRA_32) ); // is it big endian RGB?
qboolean be = ImageBigEndian( pix->type );
pbBmpBits[i*pixel_size+(be?2:0)] = pb[x*pixel_size+2];
pbBmpBits[i*pixel_size+(be?1:1)] = pb[x*pixel_size+1];
pbBmpBits[i*pixel_size+(be?0:2)] = pb[x*pixel_size+0];