[vlc-commits] freetype: read outline variable once per rendering
Francois Cartegnie
git at videolan.org
Mon Aug 17 23:43:07 CEST 2020
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Aug 13 11:54:24 2020 +0200| [1929dba2ea077dd29453335bbac79984885f1e4b] | committer: Francois Cartegnie
freetype: read outline variable once per rendering
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1929dba2ea077dd29453335bbac79984885f1e4b
---
modules/text_renderer/freetype/freetype.c | 2 ++
modules/text_renderer/freetype/freetype.h | 1 +
modules/text_renderer/freetype/text_layout.c | 3 +--
3 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/modules/text_renderer/freetype/freetype.c b/modules/text_renderer/freetype/freetype.c
index ee5212ff39..ca49f147df 100644
--- a/modules/text_renderer/freetype/freetype.c
+++ b/modules/text_renderer/freetype/freetype.c
@@ -935,6 +935,8 @@ static void UpdateDefaultLiveStyles( filter_t *p_filter )
p_style->i_background_alpha = var_InheritInteger( p_filter, "freetype-background-opacity" );
p_style->i_background_color = var_InheritInteger( p_filter, "freetype-background-color" );
+
+ p_sys->i_outline_thickness = var_InheritInteger( p_filter, "freetype-outline-thickness" );
}
static void FillDefaultStyles( filter_t *p_filter )
diff --git a/modules/text_renderer/freetype/freetype.h b/modules/text_renderer/freetype/freetype.h
index 59fb3fa30c..44d91aecd3 100644
--- a/modules/text_renderer/freetype/freetype.h
+++ b/modules/text_renderer/freetype/freetype.h
@@ -112,6 +112,7 @@ typedef struct
/* Current scaling of the text, default is 100 (%) */
int i_scale;
int i_font_default_size;
+ int i_outline_thickness;
vlc_font_select_t *fs;
diff --git a/modules/text_renderer/freetype/text_layout.c b/modules/text_renderer/freetype/text_layout.c
index 945739bc96..7adc732a14 100644
--- a/modules/text_renderer/freetype/text_layout.c
+++ b/modules/text_renderer/freetype/text_layout.c
@@ -1015,8 +1015,7 @@ static int LoadGlyphs( filter_t *p_filter, paragraph_t *p_paragraph,
if( p_sys->p_stroker && (p_style->i_style_flags & STYLE_OUTLINE) )
{
- double f_outline_thickness =
- var_InheritInteger( p_filter, "freetype-outline-thickness" ) / 100.0;
+ double f_outline_thickness = p_sys->i_outline_thickness / 100.0;
f_outline_thickness = VLC_CLIP( f_outline_thickness, 0.0, 0.5 );
int i_radius = ( i_live_size << 6 ) * f_outline_thickness;
FT_Stroker_Set( p_sys->p_stroker,
More information about the vlc-commits
mailing list