annotate libass/ass_cache_template.h @ 31223:4031008a248c

Change code to let Window Manager chose window location by default.
author reimar
date Sun, 30 May 2010 19:14:18 +0000
parents 48d020c5ceca
children 6e7f60f6f9d4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
30200
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
1 #ifdef CREATE_STRUCT_DEFINITIONS
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
2 #undef CREATE_STRUCT_DEFINITIONS
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
3 #define START(funcname, structname) \
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
4 typedef struct structname {
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
5 #define GENERIC(type, member) \
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
6 type member;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
7 #define FTVECTOR(member) \
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
8 FT_Vector member;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
9 #define BITMAPHASHKEY(member) \
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
10 BitmapHashKey member;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
11 #define END(typedefnamename) \
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
12 } typedefnamename;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
13
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
14 #elif defined(CREATE_COMPARISON_FUNCTIONS)
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
15 #undef CREATE_COMPARISON_FUNCTIONS
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
16 #define START(funcname, structname) \
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
17 static int funcname##_compare(void *key1, void *key2, size_t key_size) \
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
18 { \
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
19 struct structname *a = key1; \
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
20 struct structname *b = key2; \
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
21 return // conditions follow
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
22 #define GENERIC(type, member) \
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
23 a->member == b->member &&
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
24 #define FTVECTOR(member) \
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
25 a->member.x == b->member.x && a->member.y == b->member.y &&
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
26 #define BITMAPHASHKEY(member) \
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
27 bitmap_compare(&a->member, &b->member, sizeof(a->member)) &&
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
28 #define END(typedefname) \
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
29 1; \
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
30 }
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
31
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
32 #elif defined(CREATE_HASH_FUNCTIONS)
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
33 #undef CREATE_HASH_FUNCTIONS
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
34 #define START(funcname, structname) \
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
35 static unsigned funcname##_hash(void *buf, size_t len) \
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
36 { \
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
37 struct structname *p = buf; \
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
38 unsigned hval = FNV1_32A_INIT;
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
39 #define GENERIC(type, member) \
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
40 hval = fnv_32a_buf(&p->member, sizeof(p->member), hval);
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
41 #define FTVECTOR(member) GENERIC(, member.x); GENERIC(, member.y);
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
42 #define BITMAPHASHKEY(member) { \
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
43 unsigned temp = bitmap_hash(&p->member, sizeof(p->member)); \
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
44 hval = fnv_32a_buf(&temp, sizeof(temp), hval); \
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
45 }
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
46 #define END(typedefname) \
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
47 return hval; \
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
48 }
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
49
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
50 #else
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
51 #error missing defines
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
52 #endif
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
53
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
54
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
55
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
56 // describes a bitmap; bitmaps with equivalents structs are considered identical
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
57 START(bitmap, bitmap_hash_key)
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
58 GENERIC(char, bitmap) // bool : true = bitmap, false = outline
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
59 GENERIC(ASS_Font *, font)
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
60 GENERIC(double, size) // font size
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
61 GENERIC(uint32_t, ch) // character code
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
62 FTVECTOR(outline) // border width, 16.16 fixed point value
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
63 GENERIC(int, bold)
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
64 GENERIC(int, italic)
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
65 GENERIC(char, be) // blur edges
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
66 GENERIC(double, blur) // gaussian blur
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
67 GENERIC(unsigned, scale_x) // 16.16
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
68 GENERIC(unsigned, scale_y) // 16.16
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
69 GENERIC(int, frx) // signed 16.16
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
70 GENERIC(int, fry) // signed 16.16
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
71 GENERIC(int, frz) // signed 16.16
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
72 GENERIC(int, fax) // signed 16.16
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
73 GENERIC(int, fay) // signed 16.16
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
74 // shift vector that was added to glyph before applying rotation
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
75 // = 0, if frx = fry = frx = 0
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
76 // = (glyph base point) - (rotation origin), otherwise
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
77 GENERIC(int, shift_x)
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
78 GENERIC(int, shift_y)
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
79 FTVECTOR(advance) // subpixel shift vector
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
80 FTVECTOR(shadow_offset) // shadow subpixel shift
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
81 GENERIC(unsigned, drawing_hash) // hashcode of a drawing
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
82 GENERIC(unsigned, flags) // glyph decoration
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
83 GENERIC(unsigned, border_style)
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
84 END(BitmapHashKey)
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
85
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
86 // describes an outline glyph
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
87 START(glyph, glyph_hash_key)
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
88 GENERIC(ASS_Font *, font)
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
89 GENERIC(double, size) // font size
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
90 GENERIC(uint32_t, ch) // character code
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
91 GENERIC(int, bold)
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
92 GENERIC(int, italic)
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
93 GENERIC(unsigned, scale_x) // 16.16
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
94 GENERIC(unsigned, scale_y) // 16.16
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
95 FTVECTOR(outline) // border width, 16.16
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
96 GENERIC(unsigned, drawing_hash) // hashcode of a drawing
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
97 GENERIC(unsigned, flags) // glyph decoration flags
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
98 GENERIC(unsigned, border_style)
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
99 END(GlyphHashKey)
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
100
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
101 // Cache for composited bitmaps
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
102 START(composite, composite_hash_key)
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
103 GENERIC(int, aw)
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
104 GENERIC(int, ah)
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
105 GENERIC(int, bw)
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
106 GENERIC(int, bh)
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
107 GENERIC(int, ax)
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
108 GENERIC(int, ay)
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
109 GENERIC(int, bx)
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
110 GENERIC(int, by)
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
111 GENERIC(int, as)
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
112 GENERIC(int, bs)
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
113 GENERIC(unsigned char *, a)
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
114 GENERIC(unsigned char *, b)
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
115 END(CompositeHashKey)
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
116
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
117
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
118 #undef START
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
119 #undef GENERIC
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
120 #undef FTVECTOR
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
121 #undef BITMAPHASHKEY
48d020c5ceca Update internal libass copy to commit 8db4a5
greg
parents:
diff changeset
122 #undef END