changeset 19539:64009ae411fb

Reset glyph cache on reconfigure.
author eugeni
date Sat, 26 Aug 2006 19:00:21 +0000
parents ed0ae2df0fe8
children 70a5e89ea4cd
files libass/ass_cache.c libass/ass_cache.h libass/ass_render.c
diffstat 3 files changed, 15 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libass/ass_cache.c	Sat Aug 26 18:24:37 2006 +0000
+++ b/libass/ass_cache.c	Sat Aug 26 19:00:21 2006 +0000
@@ -190,7 +190,7 @@
 	glyph_hash_size = 0;
 }
 
-void ass_glyph_cache_done(void)
+void ass_glyph_cache_reset(void)
 {
 	int i;
 	for (i = 0; i < GLYPH_HASH_SIZE; ++i) {
@@ -203,7 +203,12 @@
 			item = next;
 		}
 	}
-	free(glyph_hash_root);
 	glyph_hash_size = 0;
 }
 
+void ass_glyph_cache_done(void)
+{
+	ass_glyph_cache_reset();
+	free(glyph_hash_root);
+}
+
--- a/libass/ass_cache.h	Sat Aug 26 18:24:37 2006 +0000
+++ b/libass/ass_cache.h	Sat Aug 26 19:00:21 2006 +0000
@@ -44,6 +44,7 @@
 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);
 
 #endif
--- a/libass/ass_render.c	Sat Aug 26 18:24:37 2006 +0000
+++ b/libass/ass_render.c	Sat Aug 26 19:00:21 2006 +0000
@@ -1737,7 +1737,13 @@
 
 void ass_configure(ass_instance_t* priv, const ass_settings_t* config)
 {
-	memcpy(&priv->settings, config, sizeof(ass_settings_t));
+	if (memcmp(&priv->settings, config, sizeof(ass_settings_t)) != 0) {
+		mp_msg(MSGT_GLOBAL, MSGL_V, "ass_configure: %d x %d; margins: l: %d, r: %d, t: %d, b: %d  \n",
+				config->frame_width, config->frame_height,
+				config->left_margin, config->right_margin, config->top_margin, config->bottom_margin);
+		memcpy(&priv->settings, config, sizeof(ass_settings_t));
+		ass_glyph_cache_reset();
+	}
 }
 
 /**