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