Reset glyph cache on reconfigure.
authoreugeni <eugeni@b3059339-0415-0410-9bf9-f77b7e298cf2>
Sat, 26 Aug 2006 19:00:21 +0000 (19:00 +0000)
committereugeni <eugeni@b3059339-0415-0410-9bf9-f77b7e298cf2>
Sat, 26 Aug 2006 19:00:21 +0000 (19:00 +0000)
git-svn-id: svn://git.mplayerhq.hu/mplayer/trunk@19545 b3059339-0415-0410-9bf9-f77b7e298cf2

libass/ass_cache.c
libass/ass_cache.h
libass/ass_render.c

index 5d400ed..8409e2d 100644 (file)
@@ -190,7 +190,7 @@ void ass_glyph_cache_init(void)
        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 @@ void ass_glyph_cache_done(void)
                        item = next;
                }
        }
-       free(glyph_hash_root);
        glyph_hash_size = 0;
 }
 
+void ass_glyph_cache_done(void)
+{
+       ass_glyph_cache_reset();
+       free(glyph_hash_root);
+}
+
index 07038b5..68f5729 100644 (file)
@@ -44,6 +44,7 @@ typedef struct glyph_hash_val_s {
 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
index 89c026a..35a5061 100644 (file)
@@ -1737,7 +1737,13 @@ int ass_render_event(ass_event_t* event)
 
 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();
+       }
 }
 
 /**