summaryrefslogtreecommitdiff
path: root/print/tex-xdvik/files/patch-texk-xdvik-util.c
blob: 2c1c820c96f8b80b0f16a8a2204169e9d067b868 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
--- texk/xdvik/util.c.orig	2014-04-08 18:43:12 UTC
+++ texk/xdvik/util.c
@@ -215,6 +215,7 @@ struct debug_string_options debug_option
     {  DBG_GUI,		"gui",		", " },
     {  DBG_FIND,	"find",		", " },
     {  DBG_FILES,	"files",	", " },
+    {  DBG_PTEXFNT,	"ptexfnt",	", " },
     {  DBG_ALL,		"all",		"\n" },
     /* end marker */
     {  0,		NULL,		NULL }
@@ -708,6 +709,38 @@ 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<size; i++) p[i] = reverse_byte[p[i]];
+}
 
 #ifndef HAVE_MEMICMP
 /*
@@ -1581,6 +1614,8 @@ put_str_int_hash(hashTableT *hashtable, 
 }
 
 
+#if FREETYPE || PS
+
 /*
  *	General AVL tree mechanism.  Search for a node, and return it if found.
  *	Otherwise insert a node.
@@ -1712,6 +1747,8 @@ avladd(const char *key, size_t key_len, 
 	return ap;
 }
 
+#endif /* FREETYPE || PS */
+
 
 /* set globals.dvi_name, globals.dvi_file.dirname and globals.dvi_file.dirlen */
 void