Commit 1cc34d8a authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf
Browse files

Add text_segment_NewInheritStyle

parent c1d3fe80
......@@ -139,6 +139,16 @@ VLC_API void text_style_Delete( text_style_t * );
*/
VLC_API text_segment_t *text_segment_New( const char * );
/**
* This function will create a new text segment and duplicates the style passed as argument
*
* You should use text_segment_ChainDelete to destroy it, to clean all
* the linked segments, or text_segment_Delete to free a specic one
*
* This doesn't initialize the text.
*/
VLC_API text_segment_t *text_segment_NewInheritStyle( const text_style_t* p_style );
/**
* Delete a text segment and its content.
*
......
......@@ -419,6 +419,7 @@ subpicture_region_Copy
subpicture_region_Delete
subpicture_region_New
text_segment_New
text_segment_NewInheritStyle
text_segment_Delete
text_segment_ChainDelete
text_segment_Copy
......
......@@ -105,6 +105,22 @@ text_segment_t *text_segment_New( const char *psz_text )
return segment;
}
text_segment_t *text_segment_NewInheritStyle( const text_style_t* p_style )
{
if ( !p_style )
return NULL; //FIXME: Allow this, even if it is an alias to text_segment_New( NULL ) ?
text_segment_t* p_segment = text_segment_New( NULL );
if ( unlikely( !p_segment ) )
return NULL;
p_segment->style = text_style_Duplicate( p_style );
if ( unlikely( !p_segment->style ) )
{
text_segment_Delete( p_segment );
return NULL;
}
return p_segment;
}
void text_segment_Delete( text_segment_t* segment )
{
if ( segment != NULL )
......
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