Fix memory leak in video_output on Mac OS X (close #6267)
[vlc/solaris.git] / src / misc / text_style.c
blob26606f907f09b9e7c0b93e1ef3ed3d6a459bc1ef
1 /*****************************************************************************
2 * text_style.c
3 *****************************************************************************
4 * Copyright (C) 1999-2010 VLC authors and VideoLAN
5 * $Id$
7 * Author: basOS G <noxelia 4t gmail , com>
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU Lesser General Public License as published by
11 * the Free Software Foundation; either version 2.1 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public License
20 * along with this program; if not, write to the Free Software Foundation,
21 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22 *****************************************************************************/
24 #ifdef HAVE_CONFIG_H
25 # include "config.h"
26 #endif
28 #include <vlc_common.h>
29 #include <vlc_text_style.h>
31 /* */
32 text_style_t *text_style_New( void )
34 text_style_t *p_style = calloc( 1, sizeof(*p_style) );
35 if( !p_style )
36 return NULL;
38 /* initialize to default text style */
39 p_style->psz_fontname = NULL;
40 p_style->i_font_size = 22;
41 p_style->i_font_color = 0xffffff;
42 p_style->i_font_alpha = 0xff;
43 p_style->i_style_flags = STYLE_OUTLINE;
44 p_style->i_outline_color = 0x000000;
45 p_style->i_outline_alpha = 0xff;
46 p_style->i_shadow_color = 0x000000;
47 p_style->i_shadow_alpha = 0xff;
48 p_style->i_background_color = 0xffffff;
49 p_style->i_background_alpha = 0x80;
50 p_style->i_karaoke_background_color = 0xffffff;
51 p_style->i_karaoke_background_alpha = 0xff;
52 p_style->i_outline_width = 1;
53 p_style->i_shadow_width = 0;
54 p_style->i_spacing = -1;
56 return p_style;
59 text_style_t *text_style_Copy( text_style_t *p_dst, const text_style_t *p_src )
61 if( !p_src )
62 return p_dst;
64 /* */
65 *p_dst = *p_src;
67 if( p_src->psz_fontname )
68 p_dst->psz_fontname = strdup( p_src->psz_fontname );
70 return p_dst;
73 text_style_t *text_style_Duplicate( const text_style_t *p_src )
75 if( !p_src )
76 return NULL;
78 text_style_t *p_dst = calloc( 1, sizeof(*p_dst) );
79 if( p_dst )
80 text_style_Copy( p_dst, p_src );
81 return p_dst;
84 void text_style_Delete( text_style_t *p_style )
86 if( p_style )
87 free( p_style->psz_fontname );
88 free( p_style );