Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
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-gpu
Commits
a147594c
Commit
a147594c
authored
Jun 16, 2011
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented per glyph alpha support.
parent
d16401e2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
11 deletions
+10
-11
modules/misc/text_renderer/freetype.c
modules/misc/text_renderer/freetype.c
+10
-11
No files found.
modules/misc/text_renderer/freetype.c
View file @
a147594c
...
@@ -203,7 +203,7 @@ struct line_desc_t
...
@@ -203,7 +203,7 @@ struct line_desc_t
FT_BitmapGlyph
*
pp_glyphs
;
FT_BitmapGlyph
*
pp_glyphs
;
/** list of relative positions for the glyphs */
/** list of relative positions for the glyphs */
FT_Vector
*
p_glyph_pos
;
FT_Vector
*
p_glyph_pos
;
/** list of RGB information for styled text */
/** list of
A
RGB information for styled text */
uint32_t
*
pi_color
;
uint32_t
*
pi_color
;
/** underline information -- only supplied if text should be underlined */
/** underline information -- only supplied if text should be underlined */
int
*
pi_underline_offset
;
int
*
pi_underline_offset
;
...
@@ -211,8 +211,6 @@ struct line_desc_t
...
@@ -211,8 +211,6 @@ struct line_desc_t
int
i_width
;
int
i_width
;
int
i_alpha
;
line_desc_t
*
p_next
;
line_desc_t
*
p_next
;
};
};
...
@@ -599,6 +597,7 @@ static int RenderYUVP( filter_t *p_filter, subpicture_region_t *p_region,
...
@@ -599,6 +597,7 @@ static int RenderYUVP( filter_t *p_filter, subpicture_region_t *p_region,
/* Calculate text color components
/* Calculate text color components
* Only use the first color */
* Only use the first color */
int
i_alpha
=
0xff
-
((
p_line
->
pi_color
[
0
]
>>
24
)
&
0xff
);
YUVFromRGB
(
p_line
->
pi_color
[
0
],
&
i_y
,
&
i_u
,
&
i_v
);
YUVFromRGB
(
p_line
->
pi_color
[
0
],
&
i_y
,
&
i_u
,
&
i_v
);
/* Build palette */
/* Build palette */
...
@@ -610,7 +609,7 @@ static int RenderYUVP( filter_t *p_filter, subpicture_region_t *p_region,
...
@@ -610,7 +609,7 @@ static int RenderYUVP( filter_t *p_filter, subpicture_region_t *p_region,
fmt
.
p_palette
->
palette
[
i
][
2
]
=
0x80
;
fmt
.
p_palette
->
palette
[
i
][
2
]
=
0x80
;
fmt
.
p_palette
->
palette
[
i
][
3
]
=
pi_gamma
[
i
];
fmt
.
p_palette
->
palette
[
i
][
3
]
=
pi_gamma
[
i
];
fmt
.
p_palette
->
palette
[
i
][
3
]
=
fmt
.
p_palette
->
palette
[
i
][
3
]
=
(
int
)
fmt
.
p_palette
->
palette
[
i
][
3
]
*
(
255
-
p_line
->
i_alpha
)
/
255
;
(
int
)
fmt
.
p_palette
->
palette
[
i
][
3
]
*
i_alpha
/
255
;
}
}
for
(
i
=
8
;
i
<
fmt
.
p_palette
->
i_entries
;
i
++
)
for
(
i
=
8
;
i
<
fmt
.
p_palette
->
i_entries
;
i
++
)
{
{
...
@@ -619,7 +618,7 @@ static int RenderYUVP( filter_t *p_filter, subpicture_region_t *p_region,
...
@@ -619,7 +618,7 @@ static int RenderYUVP( filter_t *p_filter, subpicture_region_t *p_region,
fmt
.
p_palette
->
palette
[
i
][
2
]
=
i_v
;
fmt
.
p_palette
->
palette
[
i
][
2
]
=
i_v
;
fmt
.
p_palette
->
palette
[
i
][
3
]
=
pi_gamma
[
i
];
fmt
.
p_palette
->
palette
[
i
][
3
]
=
pi_gamma
[
i
];
fmt
.
p_palette
->
palette
[
i
][
3
]
=
fmt
.
p_palette
->
palette
[
i
][
3
]
=
(
int
)
fmt
.
p_palette
->
palette
[
i
][
3
]
*
(
255
-
p_line
->
i_alpha
)
/
255
;
(
int
)
fmt
.
p_palette
->
palette
[
i
][
3
]
*
i_alpha
/
255
;
}
}
p_dst
=
p_region
->
p_picture
->
Y_PIXELS
;
p_dst
=
p_region
->
p_picture
->
Y_PIXELS
;
...
@@ -864,7 +863,7 @@ static int RenderYUVA( filter_t *p_filter,
...
@@ -864,7 +863,7 @@ static int RenderYUVA( filter_t *p_filter,
FT_BitmapGlyph
p_glyph
=
p_line
->
pp_glyphs
[
i
];
FT_BitmapGlyph
p_glyph
=
p_line
->
pp_glyphs
[
i
];
uint32_t
i_color
=
p_line
->
pi_color
[
i
];
uint32_t
i_color
=
p_line
->
pi_color
[
i
];
i_a
=
0xff
;
/* FIXME */
i_a
=
0xff
-
((
i_color
>>
24
)
&
0xff
);
YUVFromRGB
(
i_color
,
&
i_y
,
&
i_u
,
&
i_v
);
YUVFromRGB
(
i_color
,
&
i_y
,
&
i_u
,
&
i_v
);
int
i_picture_y
=
p_line
->
p_glyph_pos
[
i
].
y
+
i_align_top
;
int
i_picture_y
=
p_line
->
p_glyph_pos
[
i
].
y
+
i_align_top
;
...
@@ -1498,7 +1497,6 @@ static line_desc_t *NewLine( int i_count )
...
@@ -1498,7 +1497,6 @@ static line_desc_t *NewLine( int i_count )
return
NULL
;
return
NULL
;
p_line
->
i_width
=
0
;
p_line
->
i_width
=
0
;
p_line
->
i_alpha
=
0xff
;
p_line
->
p_next
=
NULL
;
p_line
->
p_next
=
NULL
;
...
@@ -1877,8 +1875,10 @@ static int ProcessLines( filter_t *p_filter,
...
@@ -1877,8 +1875,10 @@ static int ProcessLines( filter_t *p_filter,
.
y
=
pen
.
y
.
y
=
pen
.
y
};
};
bool
b_karaoke
=
pi_karaoke_bar
&&
pi_karaoke_bar
[
i_index
]
!=
0
;
bool
b_karaoke
=
pi_karaoke_bar
&&
pi_karaoke_bar
[
i_index
]
!=
0
;
uint32_t
i_color
=
b_karaoke
?
p_glyph_style
->
i_karaoke_background_color
uint32_t
i_color
=
b_karaoke
?
(
p_glyph_style
->
i_karaoke_background_color
|
:
p_glyph_style
->
i_font_color
;
(
p_glyph_style
->
i_karaoke_background_alpha
<<
24
))
:
(
p_glyph_style
->
i_font_color
|
(
p_glyph_style
->
i_font_alpha
<<
24
));
int
i_ul_offset
=
0
;
int
i_ul_offset
=
0
;
int
i_ul_thickness
=
0
;
int
i_ul_thickness
=
0
;
if
(
p_glyph_style
->
i_style_flags
&
(
STYLE_UNDERLINE
|
STYLE_STRIKEOUT
)
)
if
(
p_glyph_style
->
i_style_flags
&
(
STYLE_UNDERLINE
|
STYLE_STRIKEOUT
)
)
...
@@ -1943,7 +1943,7 @@ static int ProcessLines( filter_t *p_filter,
...
@@ -1943,7 +1943,7 @@ static int ProcessLines( filter_t *p_filter,
int
i_line_index
=
i_index
-
i_start
;
int
i_line_index
=
i_index
-
i_start
;
p_line
->
pp_glyphs
[
i_line_index
]
=
(
FT_BitmapGlyph
)
glyph
;
p_line
->
pp_glyphs
[
i_line_index
]
=
(
FT_BitmapGlyph
)
glyph
;
p_line
->
p_glyph_pos
[
i_line_index
]
=
glyph_pos
;
p_line
->
p_glyph_pos
[
i_line_index
]
=
glyph_pos
;
p_line
->
pi_color
[
i_line_index
]
=
i_color
;
/* FIXME alpha per glyph */
p_line
->
pi_color
[
i_line_index
]
=
i_color
;
p_line
->
pi_underline_offset
[
i_line_index
]
=
i_ul_offset
;
p_line
->
pi_underline_offset
[
i_line_index
]
=
i_ul_offset
;
p_line
->
pi_underline_thickness
[
i_line_index
]
=
i_ul_thickness
;
p_line
->
pi_underline_thickness
[
i_line_index
]
=
i_ul_thickness
;
...
@@ -1971,7 +1971,6 @@ static int ProcessLines( filter_t *p_filter,
...
@@ -1971,7 +1971,6 @@ static int ProcessLines( filter_t *p_filter,
/* Terminate and append the line */
/* Terminate and append the line */
if
(
p_line
)
if
(
p_line
)
{
{
p_line
->
i_alpha
=
0x00
;
p_line
->
i_width
=
line_bbox
.
xMax
-
line_bbox
.
xMin
;
p_line
->
i_width
=
line_bbox
.
xMax
-
line_bbox
.
xMin
;
*
pp_line_next
=
p_line
;
*
pp_line_next
=
p_line
;
pp_line_next
=
&
p_line
->
p_next
;
pp_line_next
=
&
p_line
->
p_next
;
...
...
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