Browse Source

* bitmap_print() : take packed bitmap

master
Alex 'AdUser' Z 10 years ago
parent
commit
468d2daa44
  1. 12
      src/bitmap.c

12
src/bitmap.c

@ -92,14 +92,20 @@ bitmap_unpack(const unsigned char *map,
void void
bitmap_print(const unsigned char *map) { bitmap_print(const unsigned char *map) {
unsigned char *buf = NULL, *p = NULL;
char line[BITMAP_SIDE * 2 + 1]; char line[BITMAP_SIDE * 2 + 1];
bitmap_unpack(map, &buf);
p = buf;
line[BITMAP_SIDE * 2] = '\0'; line[BITMAP_SIDE * 2] = '\0';
for (size_t i = 0; i < BITMAP_SIDE; i++) { for (size_t i = 0; i < BITMAP_SIDE; i++) {
for (size_t j = 0; j < BITMAP_SIDE; j++, map++) { for (size_t j = 0; j < BITMAP_SIDE; j++, p++) {
line[(j * 2) + 0] = (*map == 0x00) ? CHAR_NONE : CHAR_USED; line[(j * 2) + 0] = (*p == 0x00) ? CHAR_NONE : CHAR_USED;
line[(j * 2) + 1] = (*map == 0x00) ? CHAR_NONE : CHAR_USED; line[(j * 2) + 1] = (*p == 0x00) ? CHAR_NONE : CHAR_USED;
} }
puts(line); puts(line);
} }
FREE(buf);
} }

Loading…
Cancel
Save