Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
Steve Lhomme
VLC
Commits
54348a25
Commit
54348a25
authored
Jun 10, 2011
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replaced ft_style_t by text_style_t in freetype.
parent
f8486788
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
71 additions
and
94 deletions
+71
-94
modules/misc/text_renderer/freetype.c
modules/misc/text_renderer/freetype.c
+71
-94
No files found.
modules/misc/text_renderer/freetype.c
View file @
54348a25
...
@@ -226,18 +226,6 @@ struct line_desc_t
...
@@ -226,18 +226,6 @@ struct line_desc_t
static
line_desc_t
*
NewLine
(
int
);
static
line_desc_t
*
NewLine
(
int
);
static
void
FreeLines
(
line_desc_t
*
);
static
void
FreeLines
(
line_desc_t
*
);
typedef
struct
{
int
i_font_size
;
uint32_t
i_font_color
;
/* ARGB */
uint32_t
i_karaoke_bg_color
;
/* ARGB */
bool
b_italic
;
bool
b_bold
;
bool
b_underline
;
bool
b_through
;
char
*
psz_fontname
;
}
ft_style_t
;
typedef
struct
font_stack_t
font_stack_t
;
typedef
struct
font_stack_t
font_stack_t
;
struct
font_stack_t
struct
font_stack_t
{
{
...
@@ -1045,54 +1033,44 @@ static int RenderYUVA( filter_t *p_filter, subpicture_region_t *p_region,
...
@@ -1045,54 +1033,44 @@ static int RenderYUVA( filter_t *p_filter, subpicture_region_t *p_region,
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
static
f
t_style_t
*
CreateStyle
(
char
*
psz_fontname
,
int
i_font_size
,
static
tex
t_style_t
*
CreateStyle
(
char
*
psz_fontname
,
int
i_font_size
,
uint32_t
i_font_color
,
uint32_t
i_karaoke_bg_color
,
bool
b_bold
,
uint32_t
i_font_color
,
uint32_t
i_karaoke_bg_color
,
bool
b_italic
,
bool
b_uline
,
bool
b_through
)
bool
b_bold
,
bool
b_italic
,
bool
b_uline
,
bool
b_through
)
{
{
f
t_style_t
*
p_style
=
malloc
(
sizeof
(
*
p
_style
)
);
tex
t_style_t
*
p_style
=
text
_style
_New
(
);
if
(
!
p_style
)
if
(
!
p_style
)
return
NULL
;
return
NULL
;
p_style
->
i_font_size
=
i_font_size
;
p_style
->
i_font_color
=
i_font_color
;
p_style
->
i_karaoke_bg_color
=
i_karaoke_bg_color
;
p_style
->
b_italic
=
b_italic
;
p_style
->
b_bold
=
b_bold
;
p_style
->
b_underline
=
b_uline
;
p_style
->
b_through
=
b_through
;
p_style
->
psz_fontname
=
strdup
(
psz_fontname
);
p_style
->
psz_fontname
=
strdup
(
psz_fontname
);
p_style
->
i_font_size
=
i_font_size
;
p_style
->
i_font_color
=
(
i_font_color
&
0x00ffffff
)
>>
0
;
p_style
->
i_font_alpha
=
(
i_font_color
&
0xff000000
)
>>
24
;
p_style
->
i_karaoke_background_color
=
(
i_karaoke_bg_color
&
0x00ffffff
)
>>
0
;
p_style
->
i_karaoke_background_alpha
=
(
i_karaoke_bg_color
&
0xff000000
)
>>
24
;
if
(
b_bold
)
p_style
->
i_style_flags
|=
STYLE_BOLD
;
if
(
b_italic
)
p_style
->
i_style_flags
|=
STYLE_ITALIC
;
if
(
b_uline
)
p_style
->
i_style_flags
|=
STYLE_UNDERLINE
;
if
(
b_through
)
p_style
->
i_style_flags
|=
STYLE_STRIKEOUT
;
return
p_style
;
return
p_style
;
}
}
static
void
DeleteStyle
(
ft_style_t
*
p_style
)
static
bool
StyleEquals
(
text_style_t
*
s1
,
text_style_t
*
s2
)
{
if
(
!
p_style
)
return
;
free
(
p_style
->
psz_fontname
);
free
(
p_style
);
}
static
bool
StyleEquals
(
ft_style_t
*
s1
,
ft_style_t
*
s2
)
{
{
if
(
!
s1
||
!
s2
)
if
(
!
s1
||
!
s2
)
return
false
;
return
false
;
if
(
s1
==
s2
)
if
(
s1
==
s2
)
return
true
;
return
true
;
if
((
s1
->
i_font_size
==
s2
->
i_font_size
)
&&
return
s1
->
i_font_size
==
s2
->
i_font_size
&&
(
s1
->
i_font_color
==
s2
->
i_font_color
)
&&
s1
->
i_font_color
==
s2
->
i_font_color
&&
(
s1
->
b_italic
==
s2
->
b_italic
)
&&
s1
->
i_font_alpha
==
s2
->
i_font_alpha
&&
(
s1
->
b_through
==
s2
->
b_through
)
&&
s1
->
i_style_flags
==
s2
->
i_style_flags
&&
(
s1
->
b_bold
==
s2
->
b_bold
)
&&
!
strcmp
(
s1
->
psz_fontname
,
s2
->
psz_fontname
);
(
s1
->
b_underline
==
s2
->
b_underline
)
&&
(
!
strcmp
(
s1
->
psz_fontname
,
s2
->
psz_fontname
)))
{
return
true
;
}
return
false
;
}
}
static
void
IconvText
(
filter_t
*
p_filter
,
const
char
*
psz_string
,
static
void
IconvText
(
filter_t
*
p_filter
,
const
char
*
psz_string
,
...
@@ -1558,10 +1536,10 @@ static void HandleWhiteSpace( char *psz_node )
...
@@ -1558,10 +1536,10 @@ static void HandleWhiteSpace( char *psz_node )
}
}
static
f
t_style_t
*
GetStyleFromFontStack
(
filter_sys_t
*
p_sys
,
static
tex
t_style_t
*
GetStyleFromFontStack
(
filter_sys_t
*
p_sys
,
font_stack_t
**
p_fonts
,
font_stack_t
**
p_fonts
,
bool
b_bold
,
bool
b_italic
,
bool
b_bold
,
bool
b_italic
,
bool
b_uline
,
bool
b_through
)
bool
b_uline
,
bool
b_through
)
{
{
char
*
psz_fontname
=
NULL
;
char
*
psz_fontname
=
NULL
;
uint32_t
i_font_color
=
p_sys
->
i_font_color
&
0x00ffffff
;
uint32_t
i_font_color
=
p_sys
->
i_font_color
&
0x00ffffff
;
...
@@ -1576,9 +1554,10 @@ static ft_style_t *GetStyleFromFontStack( filter_sys_t *p_sys,
...
@@ -1576,9 +1554,10 @@ static ft_style_t *GetStyleFromFontStack( filter_sys_t *p_sys,
i_karaoke_bg_color
,
b_bold
,
b_italic
,
b_uline
,
b_through
);
i_karaoke_bg_color
,
b_bold
,
b_italic
,
b_uline
,
b_through
);
}
}
static
int
RenderTag
(
filter_t
*
p_filter
,
FT_Face
p_face
,
int
i_font_color
,
static
int
RenderTag
(
filter_t
*
p_filter
,
FT_Face
p_face
,
bool
b_uline
,
bool
b_through
,
bool
b_bold
,
int
i_font_color
,
bool
b_italic
,
int
i_karaoke_bgcolor
,
int
i_style_flags
,
int
i_karaoke_bgcolor
,
line_desc_t
*
p_line
,
uint32_t
*
psz_unicode
,
line_desc_t
*
p_line
,
uint32_t
*
psz_unicode
,
int
*
pi_pen_x
,
int
i_pen_y
,
int
*
pi_start
,
int
*
pi_pen_x
,
int
i_pen_y
,
int
*
pi_start
,
FT_Vector
*
p_result
)
FT_Vector
*
p_result
)
...
@@ -1649,9 +1628,9 @@ static int RenderTag( filter_t *p_filter, FT_Face p_face, int i_font_color,
...
@@ -1649,9 +1628,9 @@ static int RenderTag( filter_t *p_filter, FT_Face p_face, int i_font_color,
* ie. if the font we have loaded is NOT already in the
* ie. if the font we have loaded is NOT already in the
* style that the tags want, then switch it on; if they
* style that the tags want, then switch it on; if they
* are then don't. */
* are then don't. */
if
(
b_bold
&&
!
(
p_face
->
style_flags
&
FT_STYLE_FLAG_BOLD
))
if
(
(
i_style_flags
&
STYLE_BOLD
)
&&
!
(
p_face
->
style_flags
&
FT_STYLE_FLAG_BOLD
))
FT_GlyphSlot_Embolden
(
p_face
->
glyph
);
FT_GlyphSlot_Embolden
(
p_face
->
glyph
);
if
(
b_italic
&&
!
(
p_face
->
style_flags
&
FT_STYLE_FLAG_ITALIC
))
if
(
(
i_style_flags
&
STYLE_ITALIC
)
&&
!
(
p_face
->
style_flags
&
FT_STYLE_FLAG_ITALIC
))
FT_GlyphSlot_Oblique
(
p_face
->
glyph
);
FT_GlyphSlot_Oblique
(
p_face
->
glyph
);
i_error
=
FT_Get_Glyph
(
p_face
->
glyph
,
&
tmp_glyph
);
i_error
=
FT_Get_Glyph
(
p_face
->
glyph
,
&
tmp_glyph
);
...
@@ -1669,7 +1648,7 @@ static int RenderTag( filter_t *p_filter, FT_Face p_face, int i_font_color,
...
@@ -1669,7 +1648,7 @@ static int RenderTag( filter_t *p_filter, FT_Face p_face, int i_font_color,
FT_Done_Glyph
(
tmp_glyph
);
FT_Done_Glyph
(
tmp_glyph
);
continue
;
continue
;
}
}
if
(
b_uline
||
b_through
)
if
(
i_style_flags
&
(
STYLE_UNDERLINE
|
STYLE_STRIKEOUT
)
)
{
{
float
aOffset
=
FT_FLOOR
(
FT_MulFix
(
p_face
->
underline_position
,
float
aOffset
=
FT_FLOOR
(
FT_MulFix
(
p_face
->
underline_position
,
p_face
->
size
->
metrics
.
y_scale
));
p_face
->
size
->
metrics
.
y_scale
));
...
@@ -1680,7 +1659,7 @@ static int RenderTag( filter_t *p_filter, FT_Face p_face, int i_font_color,
...
@@ -1680,7 +1659,7 @@ static int RenderTag( filter_t *p_filter, FT_Face p_face, int i_font_color,
(
aOffset
<
0
)
?
-
aOffset
:
aOffset
;
(
aOffset
<
0
)
?
-
aOffset
:
aOffset
;
p_line
->
pi_underline_thickness
[
i
]
=
p_line
->
pi_underline_thickness
[
i
]
=
(
aSize
<
0
)
?
-
aSize
:
aSize
;
(
aSize
<
0
)
?
-
aSize
:
aSize
;
if
(
b_through
)
if
(
i_style_flags
&
STYLE_STRIKEOUT
)
{
{
/* Move the baseline to make it strikethrough instead of
/* Move the baseline to make it strikethrough instead of
* underline. That means that strikethrough takes precedence
* underline. That means that strikethrough takes precedence
...
@@ -1694,8 +1673,8 @@ static int RenderTag( filter_t *p_filter, FT_Face p_face, int i_font_color,
...
@@ -1694,8 +1673,8 @@ static int RenderTag( filter_t *p_filter, FT_Face p_face, int i_font_color,
}
}
p_line
->
pp_glyphs
[
i
]
=
(
FT_BitmapGlyph
)
tmp_glyph
;
p_line
->
pp_glyphs
[
i
]
=
(
FT_BitmapGlyph
)
tmp_glyph
;
p_line
->
p_fg_rgb
[
i
]
=
i_font_color
&
0x00ffffff
;
p_line
->
p_fg_rgb
[
i
]
=
i_font_color
;
p_line
->
p_bg_rgb
[
i
]
=
i_karaoke_bgcolor
&
0x00ffffff
;
p_line
->
p_bg_rgb
[
i
]
=
i_karaoke_bgcolor
;
p_line
->
p_fg_bg_ratio
[
i
]
=
0x00
;
p_line
->
p_fg_bg_ratio
[
i
]
=
0x00
;
line
.
xMax
=
p_line
->
p_glyph_pos
[
i
].
x
+
glyph_size
.
xMax
-
line
.
xMax
=
p_line
->
p_glyph_pos
[
i
].
x
+
glyph_size
.
xMax
-
...
@@ -1780,8 +1759,8 @@ static int RenderTag( filter_t *p_filter, FT_Face p_face, int i_font_color,
...
@@ -1780,8 +1759,8 @@ static int RenderTag( filter_t *p_filter, FT_Face p_face, int i_font_color,
static
void
SetupLine
(
filter_t
*
p_filter
,
const
char
*
psz_text_in
,
static
void
SetupLine
(
filter_t
*
p_filter
,
const
char
*
psz_text_in
,
uint32_t
**
ppsz_text_out
,
uint32_t
*
pi_runs
,
uint32_t
**
ppsz_text_out
,
uint32_t
*
pi_runs
,
uint32_t
**
ppi_run_lengths
,
f
t_style_t
***
ppp_styles
,
uint32_t
**
ppi_run_lengths
,
tex
t_style_t
***
ppp_styles
,
f
t_style_t
*
p_style
)
tex
t_style_t
*
p_style
)
{
{
size_t
i_string_length
;
size_t
i_string_length
;
...
@@ -1797,11 +1776,11 @@ static void SetupLine( filter_t *p_filter, const char *psz_text_in,
...
@@ -1797,11 +1776,11 @@ static void SetupLine( filter_t *p_filter, const char *psz_text_in,
if
(
*
ppp_styles
)
if
(
*
ppp_styles
)
{
{
*
ppp_styles
=
realloc_or_free
(
*
ppp_styles
,
*
ppp_styles
=
realloc_or_free
(
*
ppp_styles
,
*
pi_runs
*
sizeof
(
f
t_style_t
*
)
);
*
pi_runs
*
sizeof
(
tex
t_style_t
*
)
);
}
}
else
if
(
*
pi_runs
==
1
)
else
if
(
*
pi_runs
==
1
)
{
{
*
ppp_styles
=
malloc
(
*
pi_runs
*
sizeof
(
f
t_style_t
*
)
);
*
ppp_styles
=
malloc
(
*
pi_runs
*
sizeof
(
tex
t_style_t
*
)
);
}
}
/* We have just malloc'ed this memory successfully -
/* We have just malloc'ed this memory successfully -
...
@@ -1834,10 +1813,10 @@ static void SetupLine( filter_t *p_filter, const char *psz_text_in,
...
@@ -1834,10 +1813,10 @@ static void SetupLine( filter_t *p_filter, const char *psz_text_in,
/* If we couldn't use the p_style argument due to memory allocation
/* If we couldn't use the p_style argument due to memory allocation
* problems above, release it here.
* problems above, release it here.
*/
*/
Delet
eStyl
e
(
p_style
);
text_style_
Delete
(
p_style
);
}
}
static
int
CheckForEmbeddedFont
(
filter_sys_t
*
p_sys
,
FT_Face
*
pp_face
,
f
t_style_t
*
p_style
)
static
int
CheckForEmbeddedFont
(
filter_sys_t
*
p_sys
,
FT_Face
*
pp_face
,
tex
t_style_t
*
p_style
)
{
{
for
(
int
k
=
0
;
k
<
p_sys
->
i_font_attachments
;
k
++
)
for
(
int
k
=
0
;
k
<
p_sys
->
i_font_attachments
;
k
++
)
{
{
...
@@ -1857,14 +1836,14 @@ static int CheckForEmbeddedFont( filter_sys_t *p_sys, FT_Face *pp_face, ft_style
...
@@ -1857,14 +1836,14 @@ static int CheckForEmbeddedFont( filter_sys_t *p_sys, FT_Face *pp_face, ft_style
p_style
->
psz_fontname
);
p_style
->
psz_fontname
);
if
(
p_face
->
style_flags
&
FT_STYLE_FLAG_BOLD
)
if
(
p_face
->
style_flags
&
FT_STYLE_FLAG_BOLD
)
match
=
match
&&
p_style
->
b_bold
;
match
&=
(
p_style
->
i_style_flags
&
STYLE_BOLD
)
!=
0
;
else
else
match
=
match
&&
!
p_style
->
b_bold
;
match
&=
(
p_style
->
i_style_flags
&
STYLE_BOLD
)
==
0
;
if
(
p_face
->
style_flags
&
FT_STYLE_FLAG_ITALIC
)
if
(
p_face
->
style_flags
&
FT_STYLE_FLAG_ITALIC
)
match
=
match
&&
p_style
->
b_italic
;
match
&=
(
p_style
->
i_style_flags
&
STYLE_ITALIC
)
!=
0
;
else
else
match
=
match
&&
!
p_style
->
b_italic
;
match
&=
(
p_style
->
i_style_flags
&
STYLE_ITALIC
)
==
0
;
if
(
match
)
if
(
match
)
{
{
...
@@ -1888,7 +1867,7 @@ static int ProcessNodes( filter_t *p_filter,
...
@@ -1888,7 +1867,7 @@ static int ProcessNodes( filter_t *p_filter,
uint32_t
*
pi_runs
,
uint32_t
*
pi_runs
,
uint32_t
**
ppi_run_lengths
,
uint32_t
**
ppi_run_lengths
,
f
t_style_t
*
**
ppp_styles
,
tex
t_style_t
*
**
ppp_styles
,
bool
b_karaoke
,
bool
b_karaoke
,
uint32_t
*
pi_k_runs
,
uint32_t
*
pi_k_runs
,
...
@@ -2047,7 +2026,7 @@ static int ProcessLines( filter_t *p_filter,
...
@@ -2047,7 +2026,7 @@ static int ProcessLines( filter_t *p_filter,
uint32_t
i_runs
,
uint32_t
i_runs
,
uint32_t
*
pi_run_lengths
,
uint32_t
*
pi_run_lengths
,
f
t_style_t
**
pp_styles
,
tex
t_style_t
**
pp_styles
,
line_desc_t
**
pp_lines
,
line_desc_t
**
pp_lines
,
FT_Vector
*
p_result
,
FT_Vector
*
p_result
,
...
@@ -2058,7 +2037,7 @@ static int ProcessLines( filter_t *p_filter,
...
@@ -2058,7 +2037,7 @@ static int ProcessLines( filter_t *p_filter,
uint32_t
*
pi_k_durations
)
uint32_t
*
pi_k_durations
)
{
{
filter_sys_t
*
p_sys
=
p_filter
->
p_sys
;
filter_sys_t
*
p_sys
=
p_filter
->
p_sys
;
f
t_style_t
**
pp_char_styles
;
tex
t_style_t
**
pp_char_styles
;
int
*
p_new_positions
=
NULL
;
int
*
p_new_positions
=
NULL
;
int8_t
*
p_levels
=
NULL
;
int8_t
*
p_levels
=
NULL
;
uint8_t
*
pi_karaoke_bar
=
NULL
;
uint8_t
*
pi_karaoke_bar
=
NULL
;
...
@@ -2069,7 +2048,7 @@ static int ProcessLines( filter_t *p_filter,
...
@@ -2069,7 +2048,7 @@ static int ProcessLines( filter_t *p_filter,
* after the characters have been shuffled around by Fribidi, we can re-apply
* after the characters have been shuffled around by Fribidi, we can re-apply
* the styles, and to simplify the calculation of runs within a line.
* the styles, and to simplify the calculation of runs within a line.
*/
*/
pp_char_styles
=
(
f
t_style_t
**
)
malloc
(
i_len
*
sizeof
(
f
t_style_t
*
));
pp_char_styles
=
(
tex
t_style_t
**
)
malloc
(
i_len
*
sizeof
(
tex
t_style_t
*
));
if
(
!
pp_char_styles
)
if
(
!
pp_char_styles
)
return
VLC_ENOMEM
;
return
VLC_ENOMEM
;
...
@@ -2089,13 +2068,12 @@ static int ProcessLines( filter_t *p_filter,
...
@@ -2089,13 +2068,12 @@ static int ProcessLines( filter_t *p_filter,
#if defined(HAVE_FRIBIDI)
#if defined(HAVE_FRIBIDI)
{
{
f
t_style_t
**
pp_char_styles_new
;
tex
t_style_t
**
pp_char_styles_new
;
int
*
p_old_positions
;
int
*
p_old_positions
;
uint32_t
*
p_fribidi_string
;
uint32_t
*
p_fribidi_string
;
int
start_pos
,
pos
=
0
;
int
start_pos
,
pos
=
0
;
pp_char_styles_new
=
(
ft_style_t
**
)
pp_char_styles_new
=
(
text_style_t
**
)
malloc
(
i_len
*
sizeof
(
text_style_t
*
));
malloc
(
i_len
*
sizeof
(
ft_style_t
*
));
p_fribidi_string
=
(
uint32_t
*
)
p_fribidi_string
=
(
uint32_t
*
)
malloc
(
(
i_len
+
1
)
*
sizeof
(
uint32_t
)
);
malloc
(
(
i_len
+
1
)
*
sizeof
(
uint32_t
)
);
...
@@ -2251,7 +2229,7 @@ static int ProcessLines( filter_t *p_filter,
...
@@ -2251,7 +2229,7 @@ static int ProcessLines( filter_t *p_filter,
(
(
k
>
0
)
&&
(
(
k
>
0
)
&&
!
StyleEquals
(
pp_char_styles
[
k
],
pp_char_styles
[
k
-
1
]
)
)
)
!
StyleEquals
(
pp_char_styles
[
k
],
pp_char_styles
[
k
-
1
]
)
)
)
{
{
f
t_style_t
*
p_style
=
pp_char_styles
[
k
-
1
];
tex
t_style_t
*
p_style
=
pp_char_styles
[
k
-
1
];
/* End of the current style run */
/* End of the current style run */
FT_Face
p_face
=
NULL
;
FT_Face
p_face
=
NULL
;
...
@@ -2267,8 +2245,8 @@ static int ProcessLines( filter_t *p_filter,
...
@@ -2267,8 +2245,8 @@ static int ProcessLines( filter_t *p_filter,
#ifdef HAVE_FONTCONFIG
#ifdef HAVE_FONTCONFIG
psz_fontfile
=
FontConfig_Select
(
NULL
,
psz_fontfile
=
FontConfig_Select
(
NULL
,
p_style
->
psz_fontname
,
p_style
->
psz_fontname
,
p_style
->
b_bold
,
(
p_style
->
i_style_flags
&
STYLE_BOLD
)
!=
0
,
p_style
->
b_italic
,
(
p_style
->
i_style_flags
&
STYLE_ITALIC
)
!=
0
,
-
1
,
-
1
,
&
i_idx
);
&
i_idx
);
#elif defined( WIN32 )
#elif defined( WIN32 )
...
@@ -2283,11 +2261,12 @@ static int ProcessLines( filter_t *p_filter,
...
@@ -2283,11 +2261,12 @@ static int ProcessLines( filter_t *p_filter,
#endif
#endif
if
(
psz_fontfile
&&
!
*
psz_fontfile
)
if
(
psz_fontfile
&&
!
*
psz_fontfile
)
{
{
msg_Warn
(
p_filter
,
"We were not able to find a matching font:
\"
%s
\"
%s,"
msg_Warn
(
p_filter
,
" so using default font"
,
p_style
->
psz_fontname
,
"We were not able to find a matching font:
\"
%s
\"
(%s %s),"
((
p_style
->
b_bold
&&
p_style
->
b_italic
)
?
"(Bold,Italic)"
:
" so using default font"
,
(
p_style
->
b_bold
?
"(Bold)"
:
p_style
->
psz_fontname
,
(
p_style
->
b_italic
?
"(Italic)"
:
""
)))
);
(
p_style
->
i_style_flags
&
STYLE_BOLD
)
?
"Bold"
:
""
,
(
p_style
->
i_style_flags
&
STYLE_ITALIC
)
?
"Italic"
:
""
);
free
(
psz_fontfile
);
free
(
psz_fontfile
);
psz_fontfile
=
NULL
;
psz_fontfile
=
NULL
;
}
}
...
@@ -2371,10 +2350,10 @@ static int ProcessLines( filter_t *p_filter,
...
@@ -2371,10 +2350,10 @@ static int ProcessLines( filter_t *p_filter,
* need to populate the legacy colour fields also.
* need to populate the legacy colour fields also.
*/
*/
p_line
->
b_new_color_mode
=
true
;
p_line
->
b_new_color_mode
=
true
;
p_line
->
i_alpha
=
(
p_style
->
i_font_
color
&
0x
ff
000000
)
>>
24
;
p_line
->
i_alpha
=
(
p_style
->
i_font_
alpha
&
0x000000
ff
)
>>
0
;
p_line
->
i_red
=
(
p_style
->
i_font_color
&
0x00ff0000
)
>>
16
;
p_line
->
i_red
=
(
p_style
->
i_font_color
&
0x00ff0000
)
>>
16
;
p_line
->
i_green
=
(
p_style
->
i_font_color
&
0x0000ff00
)
>>
8
;
p_line
->
i_green
=
(
p_style
->
i_font_color
&
0x0000ff00
)
>>
8
;
p_line
->
i_blue
=
(
p_style
->
i_font_color
&
0x000000ff
);
p_line
->
i_blue
=
(
p_style
->
i_font_color
&
0x000000ff
)
>>
0
;
p_line
->
p_next
=
NULL
;
p_line
->
p_next
=
NULL
;
i_pen_x
=
0
;
i_pen_x
=
0
;
i_pen_y
+=
tmp_result
.
y
;
i_pen_y
+=
tmp_result
.
y
;
...
@@ -2386,11 +2365,9 @@ static int ProcessLines( filter_t *p_filter,
...
@@ -2386,11 +2365,9 @@ static int ProcessLines( filter_t *p_filter,
}
}
if
(
RenderTag
(
p_filter
,
p_face
?
p_face
:
p_sys
->
p_face
,
if
(
RenderTag
(
p_filter
,
p_face
?
p_face
:
p_sys
->
p_face
,
p_style
->
i_font_color
,
p_style
->
b_underline
,
p_style
->
i_font_color
,
p_style
->
b_through
,
p_style
->
i_style_flags
,
p_style
->
b_bold
,
p_style
->
i_karaoke_background_color
,
p_style
->
b_italic
,
p_style
->
i_karaoke_bg_color
,
p_line
,
psz_unicode
,
&
i_pen_x
,
i_pen_y
,
&
i_posn
,
p_line
,
psz_unicode
,
&
i_pen_x
,
i_pen_y
,
&
i_posn
,
&
tmp_result
)
!=
VLC_SUCCESS
)
&
tmp_result
)
!=
VLC_SUCCESS
)
{
{
...
@@ -2576,7 +2553,7 @@ static int RenderCommon( filter_t *p_filter, subpicture_region_t *p_region_out,
...
@@ -2576,7 +2553,7 @@ static int RenderCommon( filter_t *p_filter, subpicture_region_t *p_region_out,
uint32_t
*
pi_run_lengths
=
NULL
;
uint32_t
*
pi_run_lengths
=
NULL
;
uint32_t
*
pi_k_run_lengths
=
NULL
;
uint32_t
*
pi_k_run_lengths
=
NULL
;
uint32_t
*
pi_k_durations
=
NULL
;
uint32_t
*
pi_k_durations
=
NULL
;
f
t_style_t
**
pp_styles
=
NULL
;
tex
t_style_t
**
pp_styles
=
NULL
;
rv
=
ProcessNodes
(
p_filter
,
p_xml_reader
,
rv
=
ProcessNodes
(
p_filter
,
p_xml_reader
,
p_region_in
->
p_style
,
psz_text
,
&
i_text_length
,
p_region_in
->
p_style
,
psz_text
,
&
i_text_length
,
...
@@ -2593,7 +2570,7 @@ static int RenderCommon( filter_t *p_filter, subpicture_region_t *p_region_out,
...
@@ -2593,7 +2570,7 @@ static int RenderCommon( filter_t *p_filter, subpicture_region_t *p_region_out,
}
}
for
(
uint32_t
k
=
0
;
k
<
i_runs
;
k
++
)
for
(
uint32_t
k
=
0
;
k
<
i_runs
;
k
++
)
Delet
eStyl
e
(
pp_styles
[
k
]
);
text_style_
Delete
(
pp_styles
[
k
]
);
free
(
pp_styles
);
free
(
pp_styles
);
free
(
pi_run_lengths
);
free
(
pi_run_lengths
);
...
@@ -2617,7 +2594,7 @@ static int RenderCommon( filter_t *p_filter, subpicture_region_t *p_region_out,
...
@@ -2617,7 +2594,7 @@ static int RenderCommon( filter_t *p_filter, subpicture_region_t *p_region_out,
if
(
VLC_SUCCESS
==
var_Get
(
p_filter
,
"scale"
,
&
val
)
)
if
(
VLC_SUCCESS
==
var_Get
(
p_filter
,
"scale"
,
&
val
)
)
i_scale
=
val
.
i_int
;
i_scale
=
val
.
i_int
;
f
t_style_t
*
p_style
;
tex
t_style_t
*
p_style
;
if
(
p_region_in
->
p_style
)
if
(
p_region_in
->
p_style
)
p_style
=
CreateStyle
(
p_region_in
->
p_style
->
psz_fontname
,
p_style
=
CreateStyle
(
p_region_in
->
p_style
->
psz_fontname
,
p_region_in
->
p_style
->
i_font_size
*
i_scale
/
1000
,
p_region_in
->
p_style
->
i_font_size
*
i_scale
/
1000
,
...
@@ -2641,7 +2618,7 @@ static int RenderCommon( filter_t *p_filter, subpicture_region_t *p_region_out,
...
@@ -2641,7 +2618,7 @@ static int RenderCommon( filter_t *p_filter, subpicture_region_t *p_region_out,
1
,
&
i_run_length
,
&
p_style
,
1
,
&
i_run_length
,
&
p_style
,
&
p_lines
,
&
result
,
&
p_lines
,
&
result
,
false
,
0
,
NULL
,
NULL
);
false
,
0
,
NULL
,
NULL
);
Delet
eStyl
e
(
p_style
);
text_style_
Delete
(
p_style
);
}
}
free
(
psz_text
);
free
(
psz_text
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment