1
0
mirror of https://github.com/mpv-player/mpv synced 2025-02-23 00:06:56 +00:00

Use (ass_font_t, char code) instead of (FT_Face, glyph index) to identify

glyphs in cache.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@21364 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
eugeni 2006-11-28 22:17:33 +00:00
parent 3adbef1c80
commit 27ebb01514
3 changed files with 9 additions and 9 deletions

View File

@ -122,13 +122,13 @@ static int glyph_compare(glyph_hash_key_t* a, glyph_hash_key_t* b) {
static unsigned glyph_hash(glyph_hash_key_t* key) {
unsigned val = 0;
unsigned i;
for (i = 0; i < sizeof(key->face); ++i)
val += *(unsigned char *)(&(key->face) + i);
for (i = 0; i < sizeof(key->font); ++i)
val += *(unsigned char *)(&(key->font) + i);
val <<= 21;
if (key->bitmap) val &= 0x80000000;
if (key->be) val &= 0x40000000;
val += key->index;
val += key->ch;
val += key->size << 8;
val += key->outline << 3;
val += key->advance.x << 10;

View File

@ -30,9 +30,9 @@ void ass_font_cache_done(void);
// describes a glyph; glyphs with equivalents structs are considered identical
typedef struct glyph_hash_key_s {
char bitmap; // bool : true = bitmap, false = outline
FT_Face face;
ass_font_t* font;
int size; // font size
int index; // glyph index in the face
uint32_t ch; // character code
unsigned outline; // border width, 16.16 fixed point value
int bold, italic;
char be; // blur edges

View File

@ -1196,15 +1196,15 @@ static void free_render_context(void)
* \param advance advance vector of the extracted glyph
* \return 0 on success
*/
static int get_glyph(int index, int symbol, glyph_info_t* info, FT_Vector* advance)
static int get_glyph(int symbol, glyph_info_t* info, FT_Vector* advance)
{
int error;
glyph_hash_val_t* val;
glyph_hash_key_t* key = &(info->hash_key);
key->face = render_context.font->face;
key->font = render_context.font;
key->size = render_context.font_size;
key->index = index;
key->ch = symbol;
key->outline = (render_context.border * 0xFFFF); // convert to 16.16
key->scale_x = (render_context.scale_x * 0xFFFF);
key->scale_y = (render_context.scale_y * 0xFFFF);
@ -1625,7 +1625,7 @@ static int ass_render_event(ass_event_t* event, event_images_t* event_images)
ass_font_set_transform(render_context.font, &matrix, &shift );
}
error = get_glyph(glyph_index, code, text_info.glyphs + text_info.length, &shift);
error = get_glyph(code, text_info.glyphs + text_info.length, &shift);
if (error) {
continue;