--- texk/xdvik/util.c.orig 2022-02-15 20:44:41 UTC +++ texk/xdvik/util.c @@ -214,6 +214,7 @@ struct debug_string_options debug_options[] = { { DBG_GUI, "gui", ", " }, { DBG_FIND, "find", ", " }, { DBG_FILES, "files", ", " }, + { DBG_PTEXFNT, "ptexfnt", ", " }, { DBG_ALL, "all", "\n" }, /* end marker */ { 0, NULL, NULL } @@ -677,7 +678,39 @@ alloc_bitmap(struct bitmap *bitmap) bitmap->bits = xmalloc(size != 0 ? size : 1); } +void +clear_bitmap(struct bitmap *bitmap) +{ + memset(bitmap->bits, 0, bitmap->bytes_wide * bitmap->h); +} +void +fill_bitmap(struct bitmap *bitmap) +{ + memset(bitmap->bits, 0xff, bitmap->bytes_wide * bitmap->h); +} + +void +order_reverse_bitmap(struct bitmap *bitmap) +{ + int i, size = bitmap->bytes_wide * bitmap->h; + unsigned char *p = (unsigned char *)bitmap->bits; + static unsigned char reverse_byte[0x100]; + + if (reverse_byte[1] == 0) { /* init reverse_byte[] */ + for (i=0; i<0x100; i++) { + int src, dst = 0; + for (src=1; src<0x100; src<<=1) { + dst <<= 1; + if (i & src) dst |= 1; + } + reverse_byte[i] = dst; + } + } + + for (i=0; i