]> granicus.if.org Git - libass/commitdiff
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://svn.mplayerhq.hu/mplayer/trunk@19545 b3059339-0415-0410-9bf9-f77b7e298cf2

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

index 5d400ed6e7e0080d3aa0ee756e715a7d5df27fd8..8409e2d6225a0f92f800230d41b7b867fc675245 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 07038b5e47d8ff87e9e31fbb7d12cf917caedcf1..68f57296bf1886fdba904b460969cdad21a60f6f 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 89c026af5087f0425b5c0b90297a0a8b2ffbcded..35a506198e79d38e30b5c587a2aa42a051f0563f 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();
+       }
 }
 
 /**