[MPlayer-cvslog] r23035 - in trunk/libass: ass_cache.c ass_cache.h ass_render.c

eugeni subversion at mplayerhq.hu
Sat Apr 21 01:02:20 CEST 2007


Author: eugeni
Date: Sat Apr 21 01:02:20 2007
New Revision: 23035

Modified:
   trunk/libass/ass_cache.c
   trunk/libass/ass_cache.h
   trunk/libass/ass_render.c

Log:
Rename glyph cache to bitmap cache.


Modified: trunk/libass/ass_cache.c
==============================================================================
--- trunk/libass/ass_cache.c	(original)
+++ trunk/libass/ass_cache.c	Sat Apr 21 01:02:20 2007
@@ -217,13 +217,13 @@ void ass_font_cache_done(void)
 }
 
 //---------------------------------
-// glyph cache
+// bitmap cache
 
-hashmap_t* glyph_cache;
+hashmap_t* bitmap_cache;
 
-static void glyph_hash_dtor(void* key, size_t key_size, void* value, size_t value_size)
+static void bitmap_hash_dtor(void* key, size_t key_size, void* value, size_t value_size)
 {
-	glyph_hash_val_t* v = value;
+	bitmap_hash_val_t* v = value;
 	if (v->bm) ass_free_bitmap(v->bm);
 	if (v->bm_o) ass_free_bitmap(v->bm_o);
 	if (v->bm_s) ass_free_bitmap(v->bm_s);
@@ -231,37 +231,37 @@ static void glyph_hash_dtor(void* key, s
 	free(value);
 }
 
-void cache_add_glyph(glyph_hash_key_t* key, glyph_hash_val_t* val)
+void cache_add_bitmap(bitmap_hash_key_t* key, bitmap_hash_val_t* val)
 {
-	hashmap_insert(glyph_cache, key, val);
+	hashmap_insert(bitmap_cache, key, val);
 }
 
 /**
- * \brief Get a glyph from glyph cache.
+ * \brief Get a bitmap from bitmap cache.
  * \param key hash key
  * \return requested hash val or 0 if not found
 */ 
-glyph_hash_val_t* cache_find_glyph(glyph_hash_key_t* key)
+bitmap_hash_val_t* cache_find_bitmap(bitmap_hash_key_t* key)
 {
-	return hashmap_find(glyph_cache, key);
+	return hashmap_find(bitmap_cache, key);
 }
 
-void ass_glyph_cache_init(void)
+void ass_bitmap_cache_init(void)
 {
-	glyph_cache = hashmap_init(sizeof(glyph_hash_key_t),
-				   sizeof(glyph_hash_val_t),
+	bitmap_cache = hashmap_init(sizeof(bitmap_hash_key_t),
+				   sizeof(bitmap_hash_val_t),
 				   0xFFFF + 13,
-				   glyph_hash_dtor, NULL, NULL);
+				   bitmap_hash_dtor, NULL, NULL);
 }
 
-void ass_glyph_cache_done(void)
+void ass_bitmap_cache_done(void)
 {
-	hashmap_done(glyph_cache);
+	hashmap_done(bitmap_cache);
 }
 
-void ass_glyph_cache_reset(void)
+void ass_bitmap_cache_reset(void)
 {
-	ass_glyph_cache_done();
-	ass_glyph_cache_init();
+	ass_bitmap_cache_done();
+	ass_bitmap_cache_init();
 }
 

Modified: trunk/libass/ass_cache.h
==============================================================================
--- trunk/libass/ass_cache.h	(original)
+++ trunk/libass/ass_cache.h	Sat Apr 21 01:02:20 2007
@@ -27,8 +27,8 @@ void ass_font_cache_add(ass_font_t* font
 void ass_font_cache_done(void);
 
 
-// describes a glyph; glyphs with equivalents structs are considered identical
-typedef struct glyph_hash_key_s {
+// describes a bitmap; bitmaps with equivalents structs are considered identical
+typedef struct bitmap_hash_key_s {
 	char bitmap; // bool : true = bitmap, false = outline
 	ass_font_t* font;
 	int size; // font size
@@ -37,28 +37,27 @@ typedef struct glyph_hash_key_s {
 	int bold, italic;
 	char be; // blur edges
 
-	// the following affects bitmap glyphs only
 	unsigned scale_x, scale_y; // 16.16
 	int frx, fry, frz; // signed 16.16
 	
 	FT_Vector advance; // subpixel shift vector
-} glyph_hash_key_t;
+} bitmap_hash_key_t;
 
-typedef struct glyph_hash_val_s {
-	bitmap_t* bm; // the actual glyph bitmaps
+typedef struct bitmap_hash_val_s {
+	bitmap_t* bm; // the actual bitmaps
 	bitmap_t* bm_o;
 	bitmap_t* bm_s;
 	FT_BBox bbox_scaled; // bbox after scaling, but before rotation
-	FT_Vector advance; // 26.6, advance distance to the next glyph in line
-} glyph_hash_val_t;
+	FT_Vector advance; // 26.6, advance distance to the next bitmap in line
+} bitmap_hash_val_t;
 
-void ass_glyph_cache_init(void);
-void cache_add_glyph(glyph_hash_key_t* key, glyph_hash_val_t* val);
-glyph_hash_val_t* cache_find_glyph(glyph_hash_key_t* key);
-void ass_glyph_cache_reset(void);
-void ass_glyph_cache_done(void);
+void ass_bitmap_cache_init(void);
+void cache_add_bitmap(bitmap_hash_key_t* key, bitmap_hash_val_t* val);
+bitmap_hash_val_t* cache_find_bitmap(bitmap_hash_key_t* key);
+void ass_bitmap_cache_reset(void);
+void ass_bitmap_cache_done(void);
 
-typedef struct hashmap_s hashmap_t;
+typedef struct hashmap_s hashmap_t; 
 typedef void (*hashmap_item_dtor_t)(void* key, size_t key_size, void* value, size_t value_size);
 typedef int (*hashmap_key_compare_t)(void* key1, void* key2, size_t key_size);
 typedef unsigned (*hashmap_hash_t)(void* key, size_t key_size);

Modified: trunk/libass/ass_render.c
==============================================================================
--- trunk/libass/ass_render.c	(original)
+++ trunk/libass/ass_render.c	Sat Apr 21 01:02:20 2007
@@ -112,7 +112,7 @@ typedef struct glyph_info_s {
 	int shadow;
 	double frx, fry, frz; // rotation
 	
-	glyph_hash_key_t hash_key;
+	bitmap_hash_key_t hash_key;
 } glyph_info_t;
 
 typedef struct line_info_s {
@@ -252,7 +252,7 @@ ass_renderer_t* ass_renderer_init(ass_li
 	// images_root and related stuff is zero-filled in calloc
 	
 	ass_font_cache_init();
-	ass_glyph_cache_init();
+	ass_bitmap_cache_init();
 
 	text_info.glyphs = calloc(MAX_GLYPHS, sizeof(glyph_info_t));
 	
@@ -266,7 +266,7 @@ ass_init_exit:
 void ass_renderer_done(ass_renderer_t* priv)
 {
 	ass_font_cache_done();
-	ass_glyph_cache_done();
+	ass_bitmap_cache_done();
 	if (render_context.stroker) {
 		FT_Stroker_Done(render_context.stroker);
 		render_context.stroker = 0;
@@ -386,7 +386,7 @@ static ass_image_t* render_text(text_inf
 	int pen_x, pen_y;
 	int i, error;
 	bitmap_t* bm;
-	glyph_hash_val_t hash_val;
+	bitmap_hash_val_t hash_val;
 	ass_image_t* head;
 	ass_image_t** tail = &head;
 
@@ -414,7 +414,7 @@ static ass_image_t* render_text(text_inf
 				hash_val.bm_s = text_info->glyphs[i].bm_s;
 				hash_val.advance.x = text_info->glyphs[i].advance.x;
 				hash_val.advance.y = text_info->glyphs[i].advance.y;
-				cache_add_glyph(&(text_info->glyphs[i].hash_key), &hash_val);
+				cache_add_bitmap(&(text_info->glyphs[i].hash_key), &hash_val);
 			}
 
 		}
@@ -1233,8 +1233,8 @@ static void free_render_context(void)
 static void 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);
+	bitmap_hash_val_t* val;
+	bitmap_hash_key_t* key = &(info->hash_key);
 	
 	key->font = render_context.font;
 	key->size = render_context.font_size;
@@ -1250,7 +1250,7 @@ static void get_glyph(int symbol, glyph_
 	key->italic = render_context.italic;
 	key->be = render_context.be;
 
-	val = cache_find_glyph(key);
+	val = cache_find_bitmap(key);
 /* 	val = 0; */
 	
 	if (val) {
@@ -1968,7 +1968,7 @@ void ass_free_images(ass_image_t* img)
 static void ass_reconfigure(ass_renderer_t* priv)
 {
 	priv->render_id = ++last_render_id;
-	ass_glyph_cache_reset();
+	ass_bitmap_cache_reset();
 	ass_free_images(priv->prev_images_root);
 	priv->prev_images_root = 0;
 }



More information about the MPlayer-cvslog mailing list