changeset 23027:b4db05aea29e

Fill bitmap_hash_key during parsing stage, call get_bitmap_glyph() much later.
author eugeni
date Fri, 20 Apr 2007 23:16:29 +0000
parents 91076557ab81
children 57f56d8e182e
files libass/ass_render.c
diffstat 1 files changed, 19 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/libass/ass_render.c	Fri Apr 20 23:14:12 2007 +0000
+++ b/libass/ass_render.c	Fri Apr 20 23:16:29 2007 +0000
@@ -1277,25 +1277,11 @@
  * \param advance advance vector of the extracted glyph
  * \return 0 on success
  */
-static void get_bitmap_glyph(int symbol, glyph_info_t* info, FT_Vector* advance)
+static void get_bitmap_glyph(glyph_info_t* info)
 {
 	bitmap_hash_val_t* val;
 	bitmap_hash_key_t* key = &(info->hash_key);
 	
-	key->font = render_context.font;
-	key->size = render_context.font_size;
-	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);
-	key->frx = (render_context.frx * 0xFFFF);
-	key->fry = (render_context.fry * 0xFFFF);
-	key->frz = (render_context.frz * 0xFFFF);
-	key->advance = *advance;
-	key->bold = render_context.bold;
-	key->italic = render_context.italic;
-	key->be = render_context.be;
-
 	val = cache_find_bitmap(key);
 /* 	val = 0; */
 	
@@ -1760,7 +1746,6 @@
 		}
 
 		get_outline_glyph(code, text_info.glyphs + text_info.length, &shift);
-		get_bitmap_glyph(code, text_info.glyphs + text_info.length, &shift);
 		
 		text_info.glyphs[text_info.length].pos.x = pen.x >> 6;
 		text_info.glyphs[text_info.length].pos.y = pen.y >> 6;
@@ -1792,6 +1777,21 @@
 		text_info.glyphs[text_info.length].asc *= render_context.scale_y;
 		text_info.glyphs[text_info.length].desc *= render_context.scale_y;
 
+		// fill bitmap_hash_key
+		text_info.glyphs[text_info.length].hash_key.font = render_context.font;
+		text_info.glyphs[text_info.length].hash_key.size = render_context.font_size;
+		text_info.glyphs[text_info.length].hash_key.outline = render_context.border * 0xFFFF;
+		text_info.glyphs[text_info.length].hash_key.scale_x = render_context.scale_x * 0xFFFF;
+		text_info.glyphs[text_info.length].hash_key.scale_y = render_context.scale_y * 0xFFFF;
+		text_info.glyphs[text_info.length].hash_key.frx = render_context.frx * 0xFFFF;
+		text_info.glyphs[text_info.length].hash_key.fry = render_context.fry * 0xFFFF;
+		text_info.glyphs[text_info.length].hash_key.frz = render_context.frz * 0xFFFF;
+		text_info.glyphs[text_info.length].hash_key.bold = render_context.bold;
+		text_info.glyphs[text_info.length].hash_key.italic = render_context.italic;
+		text_info.glyphs[text_info.length].hash_key.ch = code;
+		text_info.glyphs[text_info.length].hash_key.advance = shift;
+		text_info.glyphs[text_info.length].hash_key.be = render_context.be;
+
 		text_info.length++;
 
 		render_context.effect_type = EF_NONE;
@@ -1926,6 +1926,9 @@
 		render_context.clip_y1 = y2scr(render_context.clip_y1);
 	}
 
+	for (i = 0; i < text_info.length; ++i)
+		get_bitmap_glyph(text_info.glyphs + i);
+
 	// rotate glyphs if needed
 	{
 		FT_Vector center;