[vlc-commits] Freetype: move GetStyleFromStack to helper

Jean-Baptiste Kempf git at videolan.org
Thu Aug 29 01:03:37 CEST 2013


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Thu Aug 29 01:01:45 2013 +0200| [d8d34fbe44aadaf34136a2da58ec0ac69a767e0a] | committer: Jean-Baptiste Kempf

Freetype: move GetStyleFromStack to helper

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d8d34fbe44aadaf34136a2da58ec0ac69a767e0a
---

 modules/text_renderer/freetype.c      |   22 ++--------------------
 modules/text_renderer/text_renderer.c |   22 ++++++++++++++++++++++
 modules/text_renderer/text_renderer.h |    5 +++++
 3 files changed, 29 insertions(+), 20 deletions(-)

diff --git a/modules/text_renderer/freetype.c b/modules/text_renderer/freetype.c
index 6bdeea9..6ced5ba 100644
--- a/modules/text_renderer/freetype.c
+++ b/modules/text_renderer/freetype.c
@@ -1245,26 +1245,6 @@ static inline int RenderAXYZ( filter_t *p_filter,
 }
 
 
-static text_style_t *GetStyleFromFontStack( filter_t *p_filter,
-                                            font_stack_t **p_fonts,
-                                            int i_style_flags )
-{
-    char       *psz_fontname = NULL;
-    uint32_t    i_font_color = var_InheritInteger( p_filter, "freetype-color" );
-    i_font_color = VLC_CLIP( i_font_color, 0, 0xFFFFFF );
-    i_font_color = i_font_color & 0x00ffffff;
-    int         i_font_size  = p_filter->p_sys->style.i_font_size;
-    uint32_t    i_karaoke_bg_color = i_font_color;
-
-    if( PeekFont( p_fonts, &psz_fontname, &i_font_size,
-                  &i_font_color, &i_karaoke_bg_color ) )
-        return NULL;
-
-    return CreateStyle( psz_fontname, i_font_size, i_font_color,
-                        i_karaoke_bg_color,
-                        i_style_flags );
-}
-
 
 static int ProcessNodes( filter_t *p_filter,
                          uni_char_t *psz_text,
@@ -1365,6 +1345,7 @@ static int ProcessNodes( filter_t *p_filter,
                                                 "\n",
                                                 GetStyleFromFontStack( p_filter,
                                                                        &p_fonts,
+                                                                       &p_sys->style,
                                                                        i_style_flags ),
                                                 i_k_date );
                 }
@@ -1396,6 +1377,7 @@ static int ProcessNodes( filter_t *p_filter,
                                             psz_node,
                                             GetStyleFromFontStack( p_filter,
                                                                    &p_fonts,
+                                                                   &p_sys->style,
                                                                    i_style_flags ),
                                             i_k_date );
                 free( psz_node );
diff --git a/modules/text_renderer/text_renderer.c b/modules/text_renderer/text_renderer.c
index 023b766..d2eea11 100644
--- a/modules/text_renderer/text_renderer.c
+++ b/modules/text_renderer/text_renderer.c
@@ -501,4 +501,26 @@ bool FaceStyleEquals( const text_style_t *p_style1,
            !strcmp( p_style1->psz_fontname, p_style2->psz_fontname );
 }
 
+text_style_t *GetStyleFromFontStack( filter_t *p_filter,
+                                     font_stack_t **p_fonts,
+                                     text_style_t *style,
+                                     int i_style_flags )
+{
+    char       *psz_fontname = NULL;
+    uint32_t    i_font_color = var_InheritInteger( p_filter, "freetype-color" );
+    i_font_color = VLC_CLIP( i_font_color, 0, 0xFFFFFF );
+    i_font_color = i_font_color & 0x00ffffff;
+
+    int         i_font_size  = style->i_font_size;
+    uint32_t    i_karaoke_bg_color = i_font_color;
+
+    if( PeekFont( p_fonts, &psz_fontname, &i_font_size,
+                  &i_font_color, &i_karaoke_bg_color ) )
+        return NULL;
+
+    return CreateStyle( psz_fontname, i_font_size, i_font_color,
+                        i_karaoke_bg_color,
+                        i_style_flags );
+}
+
 
diff --git a/modules/text_renderer/text_renderer.h b/modules/text_renderer/text_renderer.h
index d33c413..2f61147 100644
--- a/modules/text_renderer/text_renderer.h
+++ b/modules/text_renderer/text_renderer.h
@@ -60,6 +60,11 @@ text_style_t *CreateStyle( char *psz_fontname, int i_font_size,
                            uint32_t i_font_color, uint32_t i_karaoke_bg_color,
                            int i_style_flags );
 
+text_style_t *GetStyleFromFontStack( filter_t *p_filter,
+                                     font_stack_t **p_fonts,
+                                     text_style_t *style,
+                                     int i_style_flags );
+
 #ifdef __OS2__
 typedef uint16_t uni_char_t;
 # define FREETYPE_TO_UCS    "UCS-2LE"



More information about the vlc-commits mailing list