From 27ebb0151484c5cd8d6b31f10445ee448ed63382 Mon Sep 17 00:00:00 2001 From: eugeni Date: Tue, 28 Nov 2006 22:17:33 +0000 Subject: 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 --- libass/ass_cache.c | 6 +++--- libass/ass_cache.h | 4 ++-- libass/ass_render.c | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) (limited to 'libass') diff --git a/libass/ass_cache.c b/libass/ass_cache.c index 58ef9fd430..ef81fa9728 100644 --- a/libass/ass_cache.c +++ b/libass/ass_cache.c @@ -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; diff --git a/libass/ass_cache.h b/libass/ass_cache.h index 621ab162f3..bfc3557142 100644 --- a/libass/ass_cache.h +++ b/libass/ass_cache.h @@ -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 diff --git a/libass/ass_render.c b/libass/ass_render.c index 7b1be81cfa..b273b0f107 100644 --- a/libass/ass_render.c +++ b/libass/ass_render.c @@ -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; -- cgit v1.2.3