MCPcopy Create free account
hub / github.com/NetHack/NetHack / build_bmih

Function build_bmih

win/share/tile2bmp.c:287–321  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

285}
286
287static void
288build_bmih(UNALIGNED_POINTER BITMAPINFOHEADER* pbmih)
289{
290 uint16_t cClrBits;
291 int w, h;
292 pbmih->biSize = lelong(sizeof(bmp.bmih));
293 pbmih->biWidth = lelong(w = max_x);
294 pbmih->biHeight = lelong(h = max_y);
295 pbmih->biPlanes = leshort(1);
296 pbmih->biBitCount = leshort(8);
297 cClrBits = 8;
298 if (cClrBits == 1)
299 cClrBits = 1;
300 else if (cClrBits <= 4)
301 cClrBits = 4;
302 else if (cClrBits <= 8)
303 cClrBits = 8;
304 else if (cClrBits <= 16)
305 cClrBits = 16;
306 else if (cClrBits <= 24)
307 cClrBits = 24;
308 else
309 cClrBits = 32;
310 pbmih->biCompression = lelong(BI_RGB);
311 pbmih->biXPelsPerMeter = lelong(0);
312 pbmih->biYPelsPerMeter = lelong(0);
313#if (TILE_X == 32)
314 if (cClrBits < 24)
315 pbmih->biClrUsed = lelong(1 << cClrBits);
316#else
317 pbmih->biClrUsed = lelong(RGBQUAD_COUNT);
318#endif
319 pbmih->biSizeImage = lelong(((w * cClrBits + 31) & ~31) / 8 * h);
320 pbmih->biClrImportant = (uint32_t) 0;
321}
322
323static void
324build_bmptile(pixel(*pixels)[TILE_X])

Callers 1

mainFunction · 0.85

Calls 2

lelongFunction · 0.85
leshortFunction · 0.85

Tested by

no test coverage detected