Commit 3b396a3d authored by Bernie Purcell's avatar Bernie Purcell

Corrections to scaling logic in previous commit

parent 1afe5120
...@@ -98,6 +98,7 @@ static char *FontConfig_Select( FcConfig *, const char *, ...@@ -98,6 +98,7 @@ static char *FontConfig_Select( FcConfig *, const char *,
#endif #endif
static line_desc_t *NewLine( int ); static line_desc_t *NewLine( int );
static int GetFontSize( filter_t *p_filter );
static int SetFontSize( filter_t *, int ); static int SetFontSize( filter_t *, int );
static void YUVFromRGB( uint32_t i_argb, static void YUVFromRGB( uint32_t i_argb,
uint8_t *pi_y, uint8_t *pi_u, uint8_t *pi_v ); uint8_t *pi_y, uint8_t *pi_u, uint8_t *pi_v );
...@@ -1903,7 +1904,7 @@ static int ProcessNodes( filter_t *p_filter, ...@@ -1903,7 +1904,7 @@ static int ProcessNodes( filter_t *p_filter,
{ {
rv = PushFont( &p_fonts, rv = PushFont( &p_fonts,
FC_DEFAULT_FONT, FC_DEFAULT_FONT,
p_sys->i_font_size * i_scale / 1000, p_sys->i_font_size,
0x00ffffff, 0x00ffffff,
0x00ffffff ); 0x00ffffff );
} }
...@@ -2483,6 +2484,9 @@ static int RenderHtml( filter_t *p_filter, subpicture_region_t *p_region_out, ...@@ -2483,6 +2484,9 @@ static int RenderHtml( filter_t *p_filter, subpicture_region_t *p_region_out,
if( !p_region_in || !p_region_in->psz_html ) if( !p_region_in || !p_region_in->psz_html )
return VLC_EGENERIC; return VLC_EGENERIC;
/* Reset the default fontsize in case screen metrics have changed */
p_filter->p_sys->i_font_size = GetFontSize( p_filter );
p_sub = stream_MemoryNew( VLC_OBJECT(p_filter), p_sub = stream_MemoryNew( VLC_OBJECT(p_filter),
(uint8_t *) p_region_in->psz_html, (uint8_t *) p_region_in->psz_html,
strlen( p_region_in->psz_html ), strlen( p_region_in->psz_html ),
...@@ -2731,19 +2735,11 @@ static line_desc_t *NewLine( int i_count ) ...@@ -2731,19 +2735,11 @@ static line_desc_t *NewLine( int i_count )
return p_line; return p_line;
} }
static int SetFontSize( filter_t *p_filter, int i_size ) static int GetFontSize( filter_t *p_filter )
{ {
filter_sys_t *p_sys = p_filter->p_sys; filter_sys_t *p_sys = p_filter->p_sys;
if( i_size && i_size == p_sys->i_font_size ) return VLC_SUCCESS;
if( !i_size )
{
vlc_value_t val; vlc_value_t val;
int i_size = 0;
if( !p_sys->i_default_font_size &&
p_sys->i_display_height == (int)p_filter->fmt_out.video.i_height )
return VLC_SUCCESS;
if( p_sys->i_default_font_size ) if( p_sys->i_default_font_size )
{ {
...@@ -2767,6 +2763,16 @@ static int SetFontSize( filter_t *p_filter, int i_size ) ...@@ -2767,6 +2763,16 @@ static int SetFontSize( filter_t *p_filter, int i_size )
else else
i_size = 12; i_size = 12;
} }
return i_size;
}
static int SetFontSize( filter_t *p_filter, int i_size )
{
filter_sys_t *p_sys = p_filter->p_sys;
if( !i_size )
{
i_size = GetFontSize( p_filter );
msg_Dbg( p_filter, "using fontsize: %i", i_size ); msg_Dbg( p_filter, "using fontsize: %i", i_size );
} }
......
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