Commit 984e48cc authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Freetype: cosmetics, cleaning and comments

Notably in Close()
parent a43dbcf4
......@@ -1185,6 +1185,7 @@ static int Create( vlc_object_t *p_this )
if( !p_sys )
return VLC_ENOMEM;
/* Init Freetype and its stroker */
if( FT_Init_FreeType( &p_sys->p_library ) )
{
msg_Err( p_filter, "Failed to initialize FreeType" );
......@@ -1198,15 +1199,11 @@ static int Create( vlc_object_t *p_this )
p_sys->p_stroker = NULL;
}
p_sys->pp_font_attachments = NULL;
p_sys->i_font_attachments = 0;
p_sys->p_families = NULL;
/* Dictionnaries for fonts and families */
vlc_dictionary_init( &p_sys->face_map, 50 );
vlc_dictionary_init( &p_sys->family_map, 50 );
vlc_dictionary_init( &p_sys->fallback_map, 20 );
p_sys->i_fallback_counter = 0;
p_sys->i_scale = 100;
/* default style to apply to uncomplete segmeents styles */
......@@ -1306,29 +1303,7 @@ static int Create( vlc_object_t *p_this )
return VLC_SUCCESS;
error:
text_style_Delete( p_sys->p_default_style );
text_style_Delete( p_sys->p_forced_style );
vlc_dictionary_clear( &p_sys->fallback_map, FreeFamilies, p_filter );
vlc_dictionary_clear( &p_sys->face_map, FreeFace, p_filter );
vlc_dictionary_clear( &p_sys->family_map, NULL, NULL );
if( p_sys->p_families )
FreeFamiliesAndFonts( p_sys->p_families );
if( p_sys->pp_font_attachments )
{
for( int k = 0; k < p_sys->i_font_attachments; k++ )
vlc_input_attachment_Delete( p_sys->pp_font_attachments[k] );
free( p_sys->pp_font_attachments );
}
if( p_sys->p_stroker )
FT_Stroker_Done( p_sys->p_stroker );
FT_Done_FreeType( p_sys->p_library );
free( p_sys );
Destroy( VLC_OBJECT(p_filter) );
return VLC_EGENERIC;
}
......@@ -1357,12 +1332,7 @@ static void Destroy( vlc_object_t *p_this )
DumpDictionary( p_filter, &p_sys->fallback_map, true, -1 );
#endif
vlc_dictionary_clear( &p_sys->fallback_map, FreeFamilies, p_filter );
vlc_dictionary_clear( &p_sys->face_map, FreeFace, p_filter );
vlc_dictionary_clear( &p_sys->family_map, NULL, NULL );
if( p_sys->p_families )
FreeFamiliesAndFonts( p_sys->p_families );
/* Attachments */
if( p_sys->pp_font_attachments )
{
for( int k = 0; k < p_sys->i_font_attachments; k++ )
......@@ -1371,9 +1341,18 @@ static void Destroy( vlc_object_t *p_this )
free( p_sys->pp_font_attachments );
}
/* Text styles */
text_style_Delete( p_sys->p_default_style );
text_style_Delete( p_sys->p_forced_style );
/* Fonts dicts */
vlc_dictionary_clear( &p_sys->fallback_map, FreeFamilies, p_filter );
vlc_dictionary_clear( &p_sys->face_map, FreeFace, p_filter );
vlc_dictionary_clear( &p_sys->family_map, NULL, NULL );
if( p_sys->p_families )
FreeFamiliesAndFonts( p_sys->p_families );
/* Freetype */
if( p_sys->p_stroker )
FT_Stroker_Done( p_sys->p_stroker );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment