Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
f64051ad
Commit
f64051ad
authored
Aug 21, 2015
by
Francois Cartegnie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
freetype: precompute line edges
parent
e124678e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
18 deletions
+20
-18
modules/text_renderer/freetype.c
modules/text_renderer/freetype.c
+8
-18
modules/text_renderer/text_layout.c
modules/text_renderer/text_layout.c
+10
-0
modules/text_renderer/text_layout.h
modules/text_renderer/text_layout.h
+2
-0
No files found.
modules/text_renderer/freetype.c
View file @
f64051ad
...
...
@@ -700,16 +700,12 @@ static inline void RenderBackground( subpicture_region_t *p_region,
max_height
=
p_glyph
->
top
;
}
if
(
p_line
->
i_first_visible_char_index
<
0
)
continue
;
/* only spaces */
/* Compute the background for the line (identify leading/trailing space) */
for
(
int
i
=
0
;
i
<
p_line
->
i_character_count
;
i
++
)
{
const
line_character_t
*
ch
=
&
p_line
->
p_character
[
i
];
FT_BitmapGlyph
p_glyph
=
ch
->
p_outline
?
ch
->
p_outline
:
ch
->
p_glyph
;
if
(
p_glyph
&&
p_glyph
->
bitmap
.
rows
>
0
)
{
// Found a non-whitespace character
line_start
=
i_align_left
+
p_glyph
->
left
-
p_bbox
->
xMin
;
break
;
}
}
line_start
=
p_line
->
p_character
[
p_line
->
i_first_visible_char_index
].
p_glyph
->
left
+
i_align_left
-
p_bbox
->
xMin
;
/* Fudge factor to make sure caption background edges are left aligned
despite variable font width */
...
...
@@ -717,15 +713,9 @@ static inline void RenderBackground( subpicture_region_t *p_region,
line_start
=
0
;
/* Find right boundary for bounding box for background */
for
(
int
i
=
p_line
->
i_character_count
;
i
>
0
;
i
--
)
{
const
line_character_t
*
ch
=
&
p_line
->
p_character
[
i
-
1
];
FT_BitmapGlyph
p_glyph
=
ch
->
p_shadow
?
ch
->
p_shadow
:
ch
->
p_glyph
;
if
(
p_glyph
&&
p_glyph
->
bitmap
.
rows
>
0
)
{
// Found a non-whitespace character
line_end
=
i_align_left
+
p_glyph
->
left
-
p_bbox
->
xMin
+
p_glyph
->
bitmap
.
width
;
break
;
}
}
line_end
=
p_line
->
p_character
[
p_line
->
i_last_visible_char_index
].
p_glyph
->
left
+
p_line
->
p_character
[
p_line
->
i_last_visible_char_index
].
p_glyph
->
bitmap
.
width
+
i_align_left
-
p_bbox
->
xMin
;
/* Setup color for the background */
uint8_t
i_x
,
i_y
,
i_z
;
...
...
modules/text_renderer/text_layout.c
View file @
f64051ad
...
...
@@ -163,6 +163,8 @@ line_desc_t *NewLine( int i_count )
p_line
->
i_width
=
0
;
p_line
->
i_base_line
=
0
;
p_line
->
i_character_count
=
0
;
p_line
->
i_first_visible_char_index
=
-
1
;
p_line
->
i_last_visible_char_index
=
-
2
;
p_line
->
bbox
.
xMin
=
INT_MAX
;
p_line
->
bbox
.
yMin
=
INT_MAX
;
...
...
@@ -1071,6 +1073,14 @@ static int LayoutLine( filter_t *p_filter,
i_font_max_advance_y
=
abs
(
FT_FLOOR
(
FT_MulFix
(
p_face
->
max_advance_height
,
p_face
->
size
->
metrics
.
y_scale
)
)
);
}
/* Keep track of blank/spaces in front/end of line */
if
(
p_ch
->
p_glyph
->
bitmap
.
rows
)
{
if
(
p_line
->
i_first_visible_char_index
<
0
)
p_line
->
i_first_visible_char_index
=
i_line_index
;
p_line
->
i_last_visible_char_index
=
i_line_index
;
}
}
p_line
->
i_width
=
__MAX
(
0
,
p_line
->
bbox
.
xMax
-
p_line
->
bbox
.
xMin
);
...
...
modules/text_renderer/text_layout.h
View file @
f64051ad
...
...
@@ -46,6 +46,8 @@ struct line_desc_t
int
i_height
;
int
i_base_line
;
int
i_character_count
;
int
i_first_visible_char_index
;
int
i_last_visible_char_index
;
line_character_t
*
p_character
;
FT_BBox
bbox
;
};
...
...
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