Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-2-2
Commits
5bcb0a03
Commit
5bcb0a03
authored
Jun 18, 2011
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added margin when using a background in freetype.
parent
75ebe274
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
12 deletions
+23
-12
modules/misc/text_renderer/freetype.c
modules/misc/text_renderer/freetype.c
+23
-12
No files found.
modules/misc/text_renderer/freetype.c
View file @
5bcb0a03
...
...
@@ -755,17 +755,20 @@ static inline void BlendYUVALine( picture_t *p_picture,
static
int
RenderYUVA
(
filter_t
*
p_filter
,
subpicture_region_t
*
p_region
,
line_desc_t
*
p_line_head
,
FT_BBox
*
p_bbox
)
FT_BBox
*
p_bbox
,
int
i_margin
)
{
filter_sys_t
*
p_sys
=
p_filter
->
p_sys
;
/* Create a new subpicture region */
const
int
i_text_width
=
p_bbox
->
xMax
-
p_bbox
->
xMin
;
const
int
i_text_height
=
p_bbox
->
yMax
-
p_bbox
->
yMin
;
video_format_t
fmt
;
video_format_Init
(
&
fmt
,
VLC_CODEC_YUVA
);
fmt
.
i_width
=
fmt
.
i_visible_width
=
p_bbox
->
xMax
-
p_bbox
->
xM
in
;
fmt
.
i_visible_width
=
i_text_width
+
2
*
i_marg
in
;
fmt
.
i_height
=
fmt
.
i_visible_height
=
p_bbox
->
yMax
-
p_bbox
->
yM
in
;
fmt
.
i_visible_height
=
i_text_height
+
2
*
i_marg
in
;
picture_t
*
p_picture
=
p_region
->
p_picture
=
picture_NewFromFormat
(
&
fmt
);
if
(
!
p_region
->
p_picture
)
...
...
@@ -789,16 +792,16 @@ static int RenderYUVA( filter_t *p_filter,
/* Render all lines */
for
(
line_desc_t
*
p_line
=
p_line_head
;
p_line
!=
NULL
;
p_line
=
p_line
->
p_next
)
{
/* Left offset to take into account alignment */
int
i_align_left
=
0
;
if
(
p_line
->
i_width
<
fmt
.
i_visible_width
)
int
i_align_left
=
i_margin
;
if
(
p_line
->
i_width
<
i_text_width
)
{
/* Left offset to take into account alignment */
if
(
(
p_region
->
i_align
&
0x3
)
==
SUBPICTURE_ALIGN_RIGHT
)
i_align_left
=
(
fmt
.
i_visible
_width
-
p_line
->
i_width
);
i_align_left
+=
(
i_text
_width
-
p_line
->
i_width
);
else
if
(
(
p_region
->
i_align
&
0x3
)
!=
SUBPICTURE_ALIGN_LEFT
)
i_align_left
=
(
fmt
.
i_visible
_width
-
p_line
->
i_width
)
/
2
;
i_align_left
+=
(
i_text
_width
-
p_line
->
i_width
)
/
2
;
}
int
i_align_top
=
0
;
int
i_align_top
=
i_margin
;
/* Render all glyphs and underline/strikethrough */
for
(
int
i
=
0
;
i
<
p_line
->
i_character_count
;
i
++
)
...
...
@@ -1611,6 +1614,7 @@ static void BBoxEnlarge( FT_BBox *p_max, const FT_BBox *p )
static
int
ProcessLines
(
filter_t
*
p_filter
,
line_desc_t
**
pp_lines
,
FT_BBox
*
p_bbox
,
int
*
pi_max_face_height
,
uint32_t
*
psz_text
,
text_style_t
**
pp_styles
,
...
...
@@ -1706,6 +1710,7 @@ static int ProcessLines( filter_t *p_filter,
}
free
(
p_new_positions
);
*
pi_max_face_height
=
0
;
*
pp_lines
=
NULL
;
line_desc_t
**
pp_line_next
=
pp_lines
;
...
...
@@ -1967,6 +1972,8 @@ static int ProcessLines( filter_t *p_filter,
pp_line_next
=
&
p_line
->
p_next
;
}
*
pi_max_face_height
=
__MAX
(
*
pi_max_face_height
,
i_face_height
);
/* Skip what we have rendered and the line delimitor if present */
i_start
=
i_index
;
if
(
i_start
<
i_len
&&
psz_text
[
i_start
]
==
'\n'
)
...
...
@@ -2026,6 +2033,7 @@ static int RenderCommon( filter_t *p_filter, subpicture_region_t *p_region_out,
int
rv
=
VLC_SUCCESS
;
int
i_text_length
=
0
;
FT_BBox
bbox
;
int
i_max_face_height
;
line_desc_t
*
p_lines
=
NULL
;
uint32_t
*
pi_k_durations
=
NULL
;
...
...
@@ -2118,7 +2126,7 @@ static int RenderCommon( filter_t *p_filter, subpicture_region_t *p_region_out,
if
(
!
rv
&&
i_text_length
>
0
)
{
rv
=
ProcessLines
(
p_filter
,
&
p_lines
,
&
bbox
,
&
p_lines
,
&
bbox
,
&
i_max_face_height
,
psz_text
,
pp_styles
,
pi_k_durations
,
i_text_length
);
}
...
...
@@ -2132,7 +2140,10 @@ static int RenderCommon( filter_t *p_filter, subpicture_region_t *p_region_out,
if
(
var_InheritBool
(
p_filter
,
"freetype-yuvp"
)
)
RenderYUVP
(
p_filter
,
p_region_out
,
p_lines
,
&
bbox
);
else
RenderYUVA
(
p_filter
,
p_region_out
,
p_lines
,
&
bbox
);
RenderYUVA
(
p_filter
,
p_region_out
,
p_lines
,
&
bbox
,
p_sys
->
i_background_opacity
>
0
?
i_max_face_height
/
4
:
0
);
/* With karaoke, we're going to have to render the text a number
* of times to show the progress marker on the 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