diff --git a/common/com_image.h b/common/com_image.h index c65b43a1..dedbea73 100644 --- a/common/com_image.h +++ b/common/com_image.h @@ -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 { diff --git a/engine/common/imagelib/img_bmp.c b/engine/common/imagelib/img_bmp.c index dc9a9c0e..241d8915 100644 --- a/engine/common/imagelib/img_bmp.c +++ b/engine/common/imagelib/img_bmp.c @@ -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];