Mercurial > mplayer.hg
annotate libass/ass_cache.h @ 24147:2f9f0e7fe015
Remove redundant variable declarations.
author | diego |
---|---|
date | Sat, 25 Aug 2007 12:12:31 +0000 |
parents | 3f0d00abc073 |
children | 3baf6a2283da |
rev | line source |
---|---|
20008
fa122b7c71c6
Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents:
19965
diff
changeset
|
1 // -*- c-basic-offset: 8; indent-tabs-mode: t -*- |
fa122b7c71c6
Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents:
19965
diff
changeset
|
2 // vim:ts=8:sw=8:noet:ai: |
fa122b7c71c6
Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents:
19965
diff
changeset
|
3 /* |
fa122b7c71c6
Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents:
19965
diff
changeset
|
4 Copyright (C) 2006 Evgeniy Stepanov <eugeni.stepanov@gmail.com> |
fa122b7c71c6
Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents:
19965
diff
changeset
|
5 |
fa122b7c71c6
Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents:
19965
diff
changeset
|
6 This program is free software; you can redistribute it and/or modify |
fa122b7c71c6
Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents:
19965
diff
changeset
|
7 it under the terms of the GNU General Public License as published by |
fa122b7c71c6
Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents:
19965
diff
changeset
|
8 the Free Software Foundation; either version 2 of the License, or |
fa122b7c71c6
Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents:
19965
diff
changeset
|
9 (at your option) any later version. |
fa122b7c71c6
Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents:
19965
diff
changeset
|
10 |
fa122b7c71c6
Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents:
19965
diff
changeset
|
11 This program is distributed in the hope that it will be useful, |
fa122b7c71c6
Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents:
19965
diff
changeset
|
12 but WITHOUT ANY WARRANTY; without even the implied warranty of |
fa122b7c71c6
Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents:
19965
diff
changeset
|
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
fa122b7c71c6
Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents:
19965
diff
changeset
|
14 GNU General Public License for more details. |
fa122b7c71c6
Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents:
19965
diff
changeset
|
15 |
fa122b7c71c6
Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents:
19965
diff
changeset
|
16 You should have received a copy of the GNU General Public License |
fa122b7c71c6
Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents:
19965
diff
changeset
|
17 along with this program; if not, write to the Free Software |
fa122b7c71c6
Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents:
19965
diff
changeset
|
18 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
fa122b7c71c6
Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents:
19965
diff
changeset
|
19 */ |
fa122b7c71c6
Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents:
19965
diff
changeset
|
20 |
23689
3f0d00abc073
Do not use leading underscores in multiple inclusion guards, they are reserved.
diego
parents:
23300
diff
changeset
|
21 #ifndef ASS_CACHE_H |
3f0d00abc073
Do not use leading underscores in multiple inclusion guards, they are reserved.
diego
parents:
23300
diff
changeset
|
22 #define ASS_CACHE_H |
18937 | 23 |
21265 | 24 void ass_font_cache_init(void); |
21317 | 25 ass_font_t* ass_font_cache_find(ass_font_desc_t* desc); |
23211
d9b4bfea1093
Make cache_*_add functions return the pointer to new (copied) value.
eugeni
parents:
23170
diff
changeset
|
26 void* ass_font_cache_add(ass_font_t* font); |
21265 | 27 void ass_font_cache_done(void); |
18937 | 28 |
29 | |
23017 | 30 // describes a bitmap; bitmaps with equivalents structs are considered identical |
31 typedef struct bitmap_hash_key_s { | |
18937 | 32 char bitmap; // bool : true = bitmap, false = outline |
21348
d7920b488fa2
Use (ass_font_t, char code) instead of (FT_Face, glyph index) to identify
eugeni
parents:
21323
diff
changeset
|
33 ass_font_t* font; |
23300 | 34 double size; // font size |
21348
d7920b488fa2
Use (ass_font_t, char code) instead of (FT_Face, glyph index) to identify
eugeni
parents:
21323
diff
changeset
|
35 uint32_t ch; // character code |
18937 | 36 unsigned outline; // border width, 16.16 fixed point value |
37 int bold, italic; | |
19848 | 38 char be; // blur edges |
18937 | 39 |
40 unsigned scale_x, scale_y; // 16.16 | |
22215
fb365c2b3d05
Implement \frx and \fry (and reimplement \frz) as 3d rotations.
eugeni
parents:
22214
diff
changeset
|
41 int frx, fry, frz; // signed 16.16 |
23028
57f56d8e182e
Add shift_[xy] (vector that is added to the glyph before transformation) to
eugeni
parents:
23026
diff
changeset
|
42 int shift_x, shift_y; // shift vector that was added to glyph before applying rotation |
57f56d8e182e
Add shift_[xy] (vector that is added to the glyph before transformation) to
eugeni
parents:
23026
diff
changeset
|
43 // = 0, if frx = fry = frx = 0 |
57f56d8e182e
Add shift_[xy] (vector that is added to the glyph before transformation) to
eugeni
parents:
23026
diff
changeset
|
44 // = (glyph base point) - (rotation origin), otherwise |
18937 | 45 |
46 FT_Vector advance; // subpixel shift vector | |
23017 | 47 } bitmap_hash_key_t; |
18937 | 48 |
23017 | 49 typedef struct bitmap_hash_val_s { |
50 bitmap_t* bm; // the actual bitmaps | |
19846
bcc792bfa431
Store bitmap glyphs in a separate struct, instead of FreeType's internal buffer.
eugeni
parents:
19539
diff
changeset
|
51 bitmap_t* bm_o; |
19965 | 52 bitmap_t* bm_s; |
23017 | 53 } bitmap_hash_val_t; |
18937 | 54 |
23017 | 55 void ass_bitmap_cache_init(void); |
23211
d9b4bfea1093
Make cache_*_add functions return the pointer to new (copied) value.
eugeni
parents:
23170
diff
changeset
|
56 void* cache_add_bitmap(bitmap_hash_key_t* key, bitmap_hash_val_t* val); |
23017 | 57 bitmap_hash_val_t* cache_find_bitmap(bitmap_hash_key_t* key); |
58 void ass_bitmap_cache_reset(void); | |
59 void ass_bitmap_cache_done(void); | |
18937 | 60 |
23018 | 61 // describes an outline glyph |
62 typedef struct glyph_hash_key_s { | |
63 ass_font_t* font; | |
23300 | 64 double size; // font size |
23018 | 65 uint32_t ch; // character code |
66 int bold, italic; | |
67 unsigned scale_x, scale_y; // 16.16 | |
68 FT_Vector advance; // subpixel shift vector | |
23170
15a05bafc9c7
Bugfix: glyph cache depends on border width, because it contains outline_glyph
eugeni
parents:
23028
diff
changeset
|
69 unsigned outline; // border width, 16.16 |
23018 | 70 } glyph_hash_key_t; |
71 | |
72 typedef struct glyph_hash_val_s { | |
73 FT_Glyph glyph; | |
23025
ab0943242d1a
Store outline_glyph (glyph border) in glyph cache.
eugeni
parents:
23018
diff
changeset
|
74 FT_Glyph outline_glyph; |
23018 | 75 FT_BBox bbox_scaled; // bbox after scaling, but before rotation |
76 FT_Vector advance; // 26.6, advance distance to the next bitmap in line | |
77 } glyph_hash_val_t; | |
78 | |
79 void ass_glyph_cache_init(void); | |
23211
d9b4bfea1093
Make cache_*_add functions return the pointer to new (copied) value.
eugeni
parents:
23170
diff
changeset
|
80 void* cache_add_glyph(glyph_hash_key_t* key, glyph_hash_val_t* val); |
23018 | 81 glyph_hash_val_t* cache_find_glyph(glyph_hash_key_t* key); |
82 void ass_glyph_cache_reset(void); | |
83 void ass_glyph_cache_done(void); | |
84 | |
23017 | 85 typedef struct hashmap_s hashmap_t; |
23016 | 86 typedef void (*hashmap_item_dtor_t)(void* key, size_t key_size, void* value, size_t value_size); |
87 typedef int (*hashmap_key_compare_t)(void* key1, void* key2, size_t key_size); | |
88 typedef unsigned (*hashmap_hash_t)(void* key, size_t key_size); | |
89 | |
90 hashmap_t* hashmap_init(size_t key_size, size_t value_size, int nbuckets, | |
91 hashmap_item_dtor_t item_dtor, hashmap_key_compare_t key_compare, | |
92 hashmap_hash_t hash); | |
93 void hashmap_done(hashmap_t* map); | |
23211
d9b4bfea1093
Make cache_*_add functions return the pointer to new (copied) value.
eugeni
parents:
23170
diff
changeset
|
94 void* hashmap_insert(hashmap_t* map, void* key, void* value); |
23016 | 95 void* hashmap_find(hashmap_t* map, void* key); |
96 | |
18937 | 97 #endif |
98 |