Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VLC
Manage
Activity
Members
Labels
Plan
Issues
4k
Issue boards
Milestones
Code
Merge requests
455
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VideoLAN
VLC
Commits
b8c1ac48
Commit
b8c1ac48
authored
21 years ago
by
sigmunau
Browse files
Options
Downloads
Patches
Plain Diff
* osd_test.c: better size calculations. Use VLC_VAR_TIME for precise timing
(doesn't seem to work)
parent
84eeae30
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/video_filter/osd_text.c
+37
-29
37 additions, 29 deletions
modules/video_filter/osd_text.c
with
37 additions
and
29 deletions
modules/video_filter/osd_text.c
+
37
−
29
View file @
b8c1ac48
...
...
@@ -2,7 +2,7 @@
* osd_text.c : Filter to put text on the video, using freetype2
*****************************************************************************
* Copyright (C) 2002, 2003 VideoLAN
* $Id: osd_text.c,v 1.
2
2003/0
4/08 07:22:10
sigmunau Exp $
* $Id: osd_text.c,v 1.
3
2003/0
5/11 08:42:59
sigmunau Exp $
*
* Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
*
...
...
@@ -472,11 +472,13 @@ static int SetMargin ( vlc_object_t *p_this, char const *psz_command,
}
else
if
(
!
strcmp
(
psz_command
,
"start-date"
)
)
{
p_vout
->
p_sys
->
i_start_date
=
newval
.
i_int
;
p_vout
->
p_sys
->
i_start_date
=
(
(
mtime_t
)
newval
.
time
.
i_high
<<
32
)
+
newval
.
time
.
i_low
;
}
else
if
(
!
strcmp
(
psz_command
,
"end-date"
)
)
{
p_vout
->
p_sys
->
i_end_date
=
newval
.
i_int
;
p_vout
->
p_sys
->
i_end_date
=
(
(
mtime_t
)
newval
.
time
.
i_high
<<
32
)
+
newval
.
time
.
i_low
;
}
else
if
(
!
strcmp
(
psz_command
,
"flags"
)
)
{
...
...
@@ -596,50 +598,56 @@ static int AddText ( vlc_object_t *p_this, char const *psz_command,
static
void
ComputeBoundingBox
(
string_info_t
*
p_string
)
{
unsigned
int
i
,
i2
;
int
pen_y
=
0
;
unsigned
int
i
;
int
i_pen_y
=
0
;
int
i_firstline_height
=
0
;
FT_Vector
result
;
FT_
Vector
line
;
FT_
BBox
line
;
FT_BBox
glyph_size
;
result
.
x
=
0
;
result
.
y
=
0
;
line
.
x
=
0
;
line
.
y
=
0
;
line
.
xMin
=
0
;
line
.
xMax
=
0
;
line
.
yMin
=
0
;
line
.
yMax
=
0
;
for
(
i
=
0
;
i
<
strlen
(
p_string
->
psz_text
);
i
++
)
{
if
(
p_string
->
psz_text
[
i
]
==
'\n'
)
{
i2
=
i
-
1
;
while
(
i2
>=
0
&&
p_string
->
psz_text
[
i2
]
)
result
.
x
=
__MAX
(
result
.
x
,
line
.
xMax
);
result
.
y
+=
line
.
yMax
-
line
.
yMin
;
if
(
!
i_firstline_height
)
{
p_string
->
p_glyph_pos
[
i2
].
y
+=
line
.
y
;
i2
--
;
i_firstline_height
=
result
.
y
;
}
result
.
x
=
__MAX
(
result
.
x
,
line
.
x
)
;
result
.
y
+=
line
.
y
;
line
.
y
=
0
;
line
.
x
=
0
;
pen_y
=
result
.
y
;
line
.
xMin
=
0
;
line
.
xMax
=
0
;
line
.
y
Min
=
0
;
line
.
yMa
x
=
0
;
i_
pen_y
=
result
.
y
+
1
;
continue
;
}
p_string
->
p_glyph_pos
[
i
].
y
=
pen_y
;
p_string
->
p_glyph_pos
[
i
].
y
=
i_
pen_y
;
FT_Glyph_Get_CBox
(
p_string
->
pp_glyphs
[
i
],
ft_glyph_bbox_pixels
,
&
glyph_size
);
/* Do rest */
line
.
x
=
p_string
->
p_glyph_pos
[
i
].
x
+
glyph_size
.
xMax
-
glyph_size
.
xMin
;
line
.
y
=
__MAX
(
line
.
y
,
glyph_size
.
yMax
-
glyph_size
.
yMin
);
}
result
.
x
=
__MAX
(
result
.
x
,
line
.
x
);
result
.
y
+=
line
.
y
;
i2
=
i
-
1
;
while
(
i2
>=
0
&&
p_string
->
psz_text
[
i2
]
)
{
p_string
->
p_glyph_pos
[
i2
].
y
+=
line
.
y
;
i2
--
;
line
.
xMax
=
p_string
->
p_glyph_pos
[
i
].
x
+
glyph_size
.
xMax
-
glyph_size
.
xMin
;
line
.
yMax
=
__MAX
(
line
.
yMax
,
glyph_size
.
yMax
);
line
.
yMin
=
__MIN
(
line
.
yMin
,
glyph_size
.
yMin
);
}
result
.
x
=
__MAX
(
result
.
x
,
line
.
xMax
);
result
.
y
+=
line
.
yMax
-
line
.
yMin
;
p_string
->
i_height
=
result
.
y
;
p_string
->
i_width
=
result
.
x
;
if
(
!
i_firstline_height
)
{
i_firstline_height
=
result
.
y
;
}
for
(
i
=
0
;
i
<
strlen
(
p_string
->
psz_text
);
i
++
)
{
p_string
->
p_glyph_pos
[
i
].
y
+=
i_firstline_height
;
}
return
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment