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
5f7d9a68
Commit
5f7d9a68
authored
Aug 23, 2015
by
Francois Cartegnie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
freetype: really apply char background
parent
ac268ad0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
20 deletions
+42
-20
modules/text_renderer/freetype.c
modules/text_renderer/freetype.c
+38
-20
modules/text_renderer/text_layout.c
modules/text_renderer/text_layout.c
+3
-0
modules/text_renderer/text_layout.h
modules/text_renderer/text_layout.h
+1
-0
No files found.
modules/text_renderer/freetype.c
View file @
5f7d9a68
...
...
@@ -675,8 +675,6 @@ static inline void RenderBackground( subpicture_region_t *p_region,
{
int
i_align_left
=
i_margin
;
int
i_align_top
=
i_margin
;
int
line_start
=
0
;
int
line_end
=
0
;
unsigned
line_top
=
0
;
int
line_bottom
=
0
;
int
max_height
=
0
;
...
...
@@ -703,36 +701,56 @@ static inline void RenderBackground( subpicture_region_t *p_region,
if
(
p_line
->
i_first_visible_char_index
<
0
)
continue
;
/* only spaces */
/* Compute the upper boundary for the background */
line_top
=
__MAX
(
0
,
i_align_top
-
max_height
+
p_bbox
->
yMax
+
p_line
->
i_base_line
);
/* Compute lower boundary for the background */
line_bottom
=
__MIN
(
line_top
+
p_line
->
i_height
,
p_region
->
fmt
.
i_visible_height
);
/* Compute the background for the line (identify leading/trailing space) */
line_start
=
p_line
->
p_character
[
p_line
->
i_first_visible_char_index
].
p_glyph
->
left
+
i_align_left
-
p_bbox
->
xMin
;
int
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 */
if
(
line_start
<
12
)
line_start
=
0
;
/* Find right boundary for bounding box for background */
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
;
ExtractComponents
(
0x000000
,
&
i_x
,
&
i_y
,
&
i_z
);
uint32_t
i_prev_color
=
p_line
->
p_character
[
p_line
->
i_first_visible_char_index
].
i_background_color
;
/* Compute the upper boundary for the background */
line_top
=
__MAX
(
0
,
i_align_top
-
max_height
+
p_bbox
->
yMax
+
p_line
->
i_base_line
);
int
i_char_index
=
p_line
->
i_first_visible_char_index
;
while
(
i_char_index
<=
p_line
->
i_last_visible_char_index
)
{
/* find last char having the same style */
int
i_seg_end
=
i_char_index
;
while
(
i_seg_end
<
p_line
->
i_last_visible_char_index
&&
i_prev_color
==
p_line
->
p_character
[
i_seg_end
].
i_background_color
)
{
i_seg_end
++
;
}
/* Compute lower boundary for the background */
line_bottom
=
__MIN
(
line_top
+
p_line
->
i_height
,
p_region
->
fmt
.
i_visible_height
);
/* Find right boundary for bounding box for background */
int
line_end
=
p_line
->
p_character
[
i_seg_end
].
p_glyph
->
left
+
p_line
->
p_character
[
i_seg_end
].
p_glyph
->
bitmap
.
width
+
i_align_left
-
p_bbox
->
xMin
;
/* Render the actual background */
for
(
int
dy
=
line_top
;
dy
<
line_bottom
;
dy
++
)
{
for
(
int
dx
=
line_start
;
dx
<
line_end
;
dx
++
)
BlendPixel
(
p_picture
,
dx
,
dy
,
0xff
,
i_x
,
i_y
,
i_z
,
0xff
);
uint8_t
i_x
,
i_y
,
i_z
;
ExtractComponents
(
p_line
->
p_character
[
i_char_index
].
i_background_color
,
&
i_x
,
&
i_y
,
&
i_z
);
const
uint8_t
i_alpha
=
(
p_line
->
p_character
[
i_char_index
].
i_background_color
>>
24
)
&
0xFF
;
/* Render the actual background */
for
(
int
dy
=
line_top
;
dy
<
line_bottom
;
dy
++
)
{
for
(
int
dx
=
line_start
;
dx
<
line_end
;
dx
++
)
BlendPixel
(
p_picture
,
dx
,
dy
,
i_alpha
,
i_x
,
i_y
,
i_z
,
0xff
);
}
line_start
=
line_end
;
i_char_index
=
i_seg_end
+
1
;
i_prev_color
=
p_line
->
p_character
->
i_background_color
;
}
}
}
...
...
modules/text_renderer/text_layout.c
View file @
5f7d9a68
...
...
@@ -1055,6 +1055,9 @@ static int LayoutLine( filter_t *p_filter,
:
(
uint32_t
)
p_glyph_style
->
i_font_color
|
(
uint32_t
)
p_glyph_style
->
i_font_alpha
<<
24
;
p_ch
->
i_background_color
=
(
uint32_t
)
p_glyph_style
->
i_background_color
|
p_glyph_style
->
i_background_alpha
<<
24
;
p_ch
->
i_line_thickness
=
i_line_thickness
;
p_ch
->
i_line_offset
=
i_line_offset
;
...
...
modules/text_renderer/text_layout.h
View file @
5f7d9a68
...
...
@@ -33,6 +33,7 @@ typedef struct
FT_BitmapGlyph
p_outline
;
FT_BitmapGlyph
p_shadow
;
uint32_t
i_color
;
/* ARGB color */
uint32_t
i_background_color
;
/* ARGB background color */
int
i_line_offset
;
/* underline/strikethrough offset */
int
i_line_thickness
;
/* underline/strikethrough thickness */
}
line_character_t
;
...
...
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