Mercurial > mplayer.hg
annotate libass/ass_cache.h @ 30918:be200e917ae1
Remove unused OPTFLAGS variable from config.mak.
author | diego |
---|---|
date | Thu, 25 Mar 2010 19:53:05 +0000 |
parents | 48d020c5ceca |
children | 88eebbbbd6a0 |
rev | line source |
---|---|
20008
fa122b7c71c6
Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents:
19965
diff
changeset
|
1 /* |
26723 | 2 * Copyright (C) 2006 Evgeniy Stepanov <eugeni.stepanov@gmail.com> |
3 * | |
26738
588ce97b44f2
Speak of libass instead of MPlayer in the libass license headers.
diego
parents:
26723
diff
changeset
|
4 * This file is part of libass. |
26723 | 5 * |
26738
588ce97b44f2
Speak of libass instead of MPlayer in the libass license headers.
diego
parents:
26723
diff
changeset
|
6 * libass is free software; you can redistribute it and/or modify |
26723 | 7 * it under the terms of the GNU General Public License as published by |
8 * the Free Software Foundation; either version 2 of the License, or | |
9 * (at your option) any later version. | |
10 * | |
26738
588ce97b44f2
Speak of libass instead of MPlayer in the libass license headers.
diego
parents:
26723
diff
changeset
|
11 * libass is distributed in the hope that it will be useful, |
26723 | 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 * GNU General Public License for more details. | |
15 * | |
16 * You should have received a copy of the GNU General Public License along | |
26738
588ce97b44f2
Speak of libass instead of MPlayer in the libass license headers.
diego
parents:
26723
diff
changeset
|
17 * with libass; if not, write to the Free Software Foundation, Inc., |
26723 | 18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
19 */ | |
20008
fa122b7c71c6
Add copyright notice and vim/emacs comments to libass and vf_ass.c.
eugeni
parents:
19965
diff
changeset
|
20 |
25897
aaebaf255b23
Consistently give all libass multiple inclusion guards a LIBASS_ prefix.
diego
parents:
25535
diff
changeset
|
21 #ifndef LIBASS_CACHE_H |
aaebaf255b23
Consistently give all libass multiple inclusion guards a LIBASS_ prefix.
diego
parents:
25535
diff
changeset
|
22 #define LIBASS_CACHE_H |
18937 | 23 |
26138
74055622161d
Add missing header #includes to fix 'make checkheaders'.
diego
parents:
25897
diff
changeset
|
24 #include "ass.h" |
74055622161d
Add missing header #includes to fix 'make checkheaders'.
diego
parents:
25897
diff
changeset
|
25 #include "ass_font.h" |
74055622161d
Add missing header #includes to fix 'make checkheaders'.
diego
parents:
25897
diff
changeset
|
26 #include "ass_bitmap.h" |
74055622161d
Add missing header #includes to fix 'make checkheaders'.
diego
parents:
25897
diff
changeset
|
27 |
30200 | 28 typedef void (*HashmapItemDtor) (void *key, size_t key_size, |
29 void *value, size_t value_size); | |
30 typedef int (*HashmapKeyCompare) (void *key1, void *key2, | |
31 size_t key_size); | |
32 typedef unsigned (*HashmapHash) (void *key, size_t key_size); | |
18937 | 33 |
30200 | 34 typedef struct hashmap_item { |
35 void *key; | |
36 void *value; | |
37 struct hashmap_item *next; | |
38 } HashmapItem; | |
39 typedef HashmapItem *hashmap_item_p; | |
18937 | 40 |
30200 | 41 typedef struct { |
42 int nbuckets; | |
43 size_t key_size, value_size; | |
44 hashmap_item_p *root; | |
45 HashmapItemDtor item_dtor; // a destructor for hashmap key/value pairs | |
46 HashmapKeyCompare key_compare; | |
47 HashmapHash hash; | |
48 size_t cache_size; | |
49 // stats | |
50 int hit_count; | |
51 int miss_count; | |
52 int count; | |
53 ASS_Library *library; | |
54 } Hashmap; | |
18937 | 55 |
30200 | 56 Hashmap *hashmap_init(ASS_Library *library, size_t key_size, |
57 size_t value_size, int nbuckets, | |
58 HashmapItemDtor item_dtor, | |
59 HashmapKeyCompare key_compare, | |
60 HashmapHash hash); | |
61 void hashmap_done(Hashmap *map); | |
62 void *hashmap_insert(Hashmap *map, void *key, void *value); | |
63 void *hashmap_find(Hashmap *map, void *key); | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28789
diff
changeset
|
64 |
30200 | 65 Hashmap *ass_font_cache_init(ASS_Library *library); |
66 ASS_Font *ass_font_cache_find(Hashmap *, ASS_FontDesc *desc); | |
67 void *ass_font_cache_add(Hashmap *, ASS_Font *font); | |
68 void ass_font_cache_done(Hashmap *); | |
18937 | 69 |
30200 | 70 // Create definitions for bitmap_hash_key and glyph_hash_key |
71 #define CREATE_STRUCT_DEFINITIONS | |
72 #include "ass_cache_template.h" | |
18937 | 73 |
30200 | 74 typedef struct { |
75 Bitmap *bm; // the actual bitmaps | |
76 Bitmap *bm_o; | |
77 Bitmap *bm_s; | |
78 } BitmapHashValue; | |
79 | |
80 Hashmap *ass_bitmap_cache_init(ASS_Library *library); | |
81 void *cache_add_bitmap(Hashmap *, BitmapHashKey *key, | |
82 BitmapHashValue *val); | |
83 BitmapHashValue *cache_find_bitmap(Hashmap *bitmap_cache, | |
84 BitmapHashKey *key); | |
85 Hashmap *ass_bitmap_cache_reset(Hashmap *bitmap_cache); | |
86 void ass_bitmap_cache_done(Hashmap *bitmap_cache); | |
18937 | 87 |
28789
a0ce88ba2557
Combine adjacent overlapping, translucent glyph borders and shadows to
greg
parents:
28436
diff
changeset
|
88 |
30200 | 89 typedef struct { |
90 unsigned char *a; | |
91 unsigned char *b; | |
92 } CompositeHashValue; | |
28789
a0ce88ba2557
Combine adjacent overlapping, translucent glyph borders and shadows to
greg
parents:
28436
diff
changeset
|
93 |
30200 | 94 Hashmap *ass_composite_cache_init(ASS_Library *library); |
95 void *cache_add_composite(Hashmap *, CompositeHashKey *key, | |
96 CompositeHashValue *val); | |
97 CompositeHashValue *cache_find_composite(Hashmap *composite_cache, | |
98 CompositeHashKey *key); | |
99 Hashmap *ass_composite_cache_reset(Hashmap *composite_cache); | |
100 void ass_composite_cache_done(Hashmap *composite_cache); | |
28789
a0ce88ba2557
Combine adjacent overlapping, translucent glyph borders and shadows to
greg
parents:
28436
diff
changeset
|
101 |
a0ce88ba2557
Combine adjacent overlapping, translucent glyph borders and shadows to
greg
parents:
28436
diff
changeset
|
102 |
30200 | 103 typedef struct { |
104 FT_Glyph glyph; | |
105 FT_Glyph outline_glyph; | |
106 FT_BBox bbox_scaled; // bbox after scaling, but before rotation | |
107 FT_Vector advance; // 26.6, advance distance to the next bitmap in line | |
108 int asc, desc; // ascender/descender of a drawing | |
109 } GlyphHashValue; | |
23018 | 110 |
30200 | 111 Hashmap *ass_glyph_cache_init(ASS_Library *library); |
112 void *cache_add_glyph(Hashmap *, GlyphHashKey *key, | |
113 GlyphHashValue *val); | |
114 GlyphHashValue *cache_find_glyph(Hashmap *glyph_cache, | |
115 GlyphHashKey *key); | |
116 Hashmap *ass_glyph_cache_reset(Hashmap *glyph_cache); | |
117 void ass_glyph_cache_done(Hashmap *glyph_cache); | |
23018 | 118 |
30200 | 119 #endif /* LIBASS_CACHE_H */ |