engine: imagelib: refactor to use stdint.h definitions, use spaces for alignment instead of tabs

This commit is contained in:
Alibek Omarov 2020-05-11 02:28:04 +03:00
parent 95393cde72
commit 46b0590e4e
4 changed files with 73 additions and 73 deletions

View File

@ -30,21 +30,21 @@ GNU General Public License for more details.
#pragma pack( push, 1 )
typedef struct
{
char id[2]; // bmfh.bfType
dword fileSize; // bmfh.bfSize
dword reserved0; // bmfh.bfReserved1 + bmfh.bfReserved2
dword bitmapDataOffset; // bmfh.bfOffBits
dword bitmapHeaderSize; // bmih.biSize
int width; // bmih.biWidth
int height; // bmih.biHeight
word planes; // bmih.biPlanes
word bitsPerPixel; // bmih.biBitCount
dword compression; // bmih.biCompression
dword bitmapDataSize; // bmih.biSizeImage
dword hRes; // bmih.biXPelsPerMeter
dword vRes; // bmih.biYPelsPerMeter
dword colors; // bmih.biClrUsed
dword importantColors; // bmih.biClrImportant
int8_t id[2]; // bmfh.bfType
uint32_t fileSize; // bmfh.bfSize
uint32_t reserved0; // bmfh.bfReserved1 + bmfh.bfReserved2
uint32_t bitmapDataOffset; // bmfh.bfOffBits
uint32_t bitmapHeaderSize; // bmih.biSize
int32_t width; // bmih.biWidth
int32_t height; // bmih.biHeight
uint16_t planes; // bmih.biPlanes
uint16_t bitsPerPixel; // bmih.biBitCount
uint32_t compression; // bmih.biCompression
uint32_t bitmapDataSize; // bmih.biSizeImage
uint32_t hRes; // bmih.biXPelsPerMeter
uint32_t vRes; // bmih.biYPelsPerMeter
uint32_t colors; // bmih.biClrUsed
uint32_t importantColors; // bmih.biClrImportant
} bmp_t;
#pragma pack( pop )
#endif // IMG_BMP_H

View File

@ -77,40 +77,40 @@ GNU General Public License for more details.
typedef struct dds_pf_s
{
uint dwSize;
uint dwFlags;
uint dwFourCC;
uint dwRGBBitCount;
uint dwRBitMask;
uint dwGBitMask;
uint dwBBitMask;
uint dwABitMask;
uint32_t dwSize;
uint32_t dwFlags;
uint32_t dwFourCC;
uint32_t dwRGBBitCount;
uint32_t dwRBitMask;
uint32_t dwGBitMask;
uint32_t dwBBitMask;
uint32_t dwABitMask;
} dds_pixf_t;
// DDCAPS2
typedef struct dds_caps_s
{
uint dwCaps1;
uint dwCaps2;
uint dwCaps3; // currently unused
uint dwCaps4; // currently unused
uint32_t dwCaps1;
uint32_t dwCaps2;
uint32_t dwCaps3; // currently unused
uint32_t dwCaps4; // currently unused
} dds_caps_t;
typedef struct dds_s
{
uint dwIdent; // must matched with DDSHEADER
uint dwSize;
uint dwFlags; // determines what fields are valid
uint dwHeight;
uint dwWidth;
uint dwLinearSize; // Formless late-allocated optimized surface size
uint dwDepth; // depth if a volume texture
uint dwMipMapCount; // number of mip-map levels requested
uint dwAlphaBitDepth; // depth of alpha buffer requested
uint dwReserved1[10]; // reserved for future expansions
dds_pixf_t dsPixelFormat;
dds_caps_t dsCaps;
uint dwTextureStage;
uint32_t dwIdent; // must matched with DDSHEADER
uint32_t dwSize;
uint32_t dwFlags; // determines what fields are valid
uint32_t dwHeight;
uint32_t dwWidth;
uint32_t dwLinearSize; // Formless late-allocated optimized surface size
uint32_t dwDepth; // depth if a volume texture
uint32_t dwMipMapCount; // number of mip-map levels requested
uint32_t dwAlphaBitDepth; // depth of alpha buffer requested
uint32_t dwReserved1[10]; // reserved for future expansions
dds_pixf_t dsPixelFormat;
dds_caps_t dsCaps;
uint32_t dwTextureStage;
} dds_t;
#endif // IMG_DDS_H

View File

@ -22,52 +22,52 @@ GNU General Public License for more details.
========================================================================
*/
enum
enum png_colortype
{
PNG_CT_GREY,
PNG_CT_PALLETE = BIT(0),
PNG_CT_RGB = BIT(1),
PNG_CT_ALPHA = BIT(2),
PNG_CT_RGBA = (PNG_CT_RGB|PNG_CT_ALPHA)
} png_colortype;
};
enum
enum png_filter
{
PNG_F_NONE,
PNG_F_SUB,
PNG_F_UP,
PNG_F_AVERAGE,
PNG_F_PAETH
} png_filter;
};
#pragma pack( push, 1 )
typedef struct png_ihdr_s
{
uint width;
uint height;
byte bitdepth;
byte colortype;
byte compression;
byte filter;
byte interlace;
uint32_t width;
uint32_t height;
uint8_t bitdepth;
uint8_t colortype;
uint8_t compression;
uint8_t filter;
uint8_t interlace;
} png_ihdr_t;
typedef struct png_s
{
byte sign[8];
uint ihdr_len;
byte ihdr_sign[4];
png_ihdr_t ihdr_chunk;
uint ihdr_crc32;
uint8_t sign[8];
uint32_t ihdr_len;
uint8_t ihdr_sign[4];
png_ihdr_t ihdr_chunk;
uint32_t ihdr_crc32;
} png_t;
#pragma pack( pop )
typedef struct png_footer_s
{
uint idat_crc32;
uint iend_len;
byte iend_sign[4];
uint iend_crc32;
uint32_t idat_crc32;
uint32_t iend_len;
uint8_t iend_sign[4];
uint32_t iend_crc32;
} png_footer_t;
#pragma pack( pop )
#endif // IMG_PNG_H

View File

@ -24,18 +24,18 @@ GNU General Public License for more details.
#pragma pack( push, 1 )
typedef struct tga_s
{
byte id_length;
byte colormap_type;
byte image_type;
word colormap_index;
word colormap_length;
byte colormap_size;
word x_origin;
word y_origin;
word width;
word height;
byte pixel_size;
byte attributes;
uint8_t id_length;
uint8_t colormap_type;
uint8_t image_type;
uint16_t colormap_index;
uint16_t colormap_length;
uint8_t colormap_size;
uint16_t x_origin;
uint16_t y_origin;
uint16_t width;
uint16_t height;
uint8_t pixel_size;
uint8_t attributes;
} tga_t;
#pragma pack( pop )
#endif // IMG_TGA_H