mirror of
https://github.com/libretro/RetroArch
synced 2025-02-20 15:40:44 +00:00
(rbmp_encode.c) Make it C89-friendly
This commit is contained in:
parent
b9ba75403e
commit
4c2bc0c1fe
@ -31,44 +31,79 @@ static bool write_header_bmp(RFILE *file, unsigned width, unsigned height)
|
||||
unsigned line_size = (width * 3 + 3) & ~3;
|
||||
unsigned size = line_size * height + 54;
|
||||
unsigned size_array = line_size * height;
|
||||
uint8_t header[54];
|
||||
|
||||
/* Generic BMP stuff. */
|
||||
const uint8_t header[] = {
|
||||
/* signature */
|
||||
'B', 'M',
|
||||
/* file size */
|
||||
(uint8_t)(size >> 0), (uint8_t)(size >> 8),
|
||||
(uint8_t)(size >> 16), (uint8_t)(size >> 24),
|
||||
/* reserved */
|
||||
0, 0, 0, 0,
|
||||
/* offset */
|
||||
54, 0, 0, 0,
|
||||
/* DIB size */
|
||||
40, 0, 0, 0,
|
||||
/* width */
|
||||
(uint8_t)(width >> 0), (uint8_t)(width >> 8),
|
||||
(uint8_t)(width >> 16), (uint8_t)(width >> 24),
|
||||
/* height */
|
||||
(uint8_t)(height >> 0), (uint8_t)(height >> 8),
|
||||
(uint8_t)(height >> 16), (uint8_t)(height >> 24),
|
||||
/* color planes */
|
||||
1, 0,
|
||||
/* bits per pixel */
|
||||
24, 0,
|
||||
/* compression method */
|
||||
0, 0, 0, 0,
|
||||
/* image data size */
|
||||
(uint8_t)(size_array >> 0), (uint8_t)(size_array >> 8),
|
||||
(uint8_t)(size_array >> 16), (uint8_t)(size_array >> 24),
|
||||
/* horizontal resolution */
|
||||
19, 11, 0, 0,
|
||||
/* vertical resolution */
|
||||
19, 11, 0, 0,
|
||||
/* palette size */
|
||||
0, 0, 0, 0,
|
||||
/* important color count */
|
||||
0, 0, 0, 0
|
||||
};
|
||||
|
||||
/* signature */
|
||||
header[0] = 'B';
|
||||
header[1] = 'M';
|
||||
/* file size */
|
||||
header[2] = (uint8_t)(size >> 0);
|
||||
header[3] = (uint8_t)(size >> 8);
|
||||
header[4] = (uint8_t)(size >> 16);
|
||||
header[5] = (uint8_t)(size >> 24);
|
||||
/* reserved */
|
||||
header[6] = 0;
|
||||
header[7] = 0;
|
||||
header[8] = 0;
|
||||
header[9] = 0;
|
||||
/* offset */
|
||||
header[10] = 54;
|
||||
header[11] = 0;
|
||||
header[12] = 0;
|
||||
header[13] = 0;
|
||||
/* DIB size */
|
||||
header[14] = 40;
|
||||
header[15] = 0;
|
||||
header[16] = 0;
|
||||
header[17] = 0;
|
||||
/* Width */
|
||||
header[18] = (uint8_t)(width >> 0);
|
||||
header[19] = (uint8_t)(width >> 8);
|
||||
header[20] = (uint8_t)(width >> 16);
|
||||
header[21] = (uint8_t)(width >> 24);
|
||||
/* Height */
|
||||
header[22] = (uint8_t)(height >> 0);
|
||||
header[23] = (uint8_t)(height >> 8);
|
||||
header[24] = (uint8_t)(height >> 16);
|
||||
header[25] = (uint8_t)(height >> 24);
|
||||
/* Color planes */
|
||||
header[26] = 1;
|
||||
header[27] = 0;
|
||||
/* Bits per pixel */
|
||||
header[28] = 24;
|
||||
header[29] = 0;
|
||||
/* Compression method */
|
||||
header[30] = 0;
|
||||
header[31] = 0;
|
||||
header[32] = 0;
|
||||
header[33] = 0;
|
||||
/* Image data size */
|
||||
header[34] = (uint8_t)(size_array >> 0);
|
||||
header[35] = (uint8_t)(size_array >> 8);
|
||||
header[36] = (uint8_t)(size_array >> 16);
|
||||
header[37] = (uint8_t)(size_array >> 24);
|
||||
/* Horizontal resolution */
|
||||
header[38] = 19;
|
||||
header[39] = 11;
|
||||
header[40] = 0;
|
||||
header[41] = 0;
|
||||
/* Vertical resolution */
|
||||
header[42] = 19;
|
||||
header[43] = 11;
|
||||
header[44] = 0;
|
||||
header[45] = 0;
|
||||
/* Palette size */
|
||||
header[46] = 0;
|
||||
header[47] = 0;
|
||||
header[48] = 0;
|
||||
header[49] = 0;
|
||||
/* Important color count */
|
||||
header[50] = 0;
|
||||
header[51] = 0;
|
||||
header[52] = 0;
|
||||
header[53] = 0;
|
||||
|
||||
return retro_fwrite(file, header, sizeof(header)) == sizeof(header);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user