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
a5dcac28
Commit
a5dcac28
authored
Aug 17, 2003
by
Sigmund Augdal Helberg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modules/misc/freetype.c:
* added support for RV32/RV24 chroma
parent
13f2015e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
72 additions
and
4 deletions
+72
-4
modules/misc/freetype.c
modules/misc/freetype.c
+72
-4
No files found.
modules/misc/freetype.c
View file @
a5dcac28
...
...
@@ -2,7 +2,7 @@
* freetype.c : Put text on the video, using freetype2
*****************************************************************************
* Copyright (C) 2002, 2003 VideoLAN
* $Id: freetype.c,v 1.1
7 2003/08/10 10:22:52 gbazin
Exp $
* $Id: freetype.c,v 1.1
8 2003/08/17 15:22:49 sigmunau
Exp $
*
* Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
*
...
...
@@ -58,6 +58,8 @@ static void RenderI420( vout_thread_t *, picture_t *,
const
subpicture_t
*
);
static
void
RenderYUY2
(
vout_thread_t
*
,
picture_t
*
,
const
subpicture_t
*
);
static
void
RenderRV32
(
vout_thread_t
*
,
picture_t
*
,
const
subpicture_t
*
);
static
int
AddText
(
vout_thread_t
*
,
byte_t
*
,
text_style_t
*
,
int
,
int
,
int
,
mtime_t
,
mtime_t
);
static
void
FreeString
(
subpicture_t
*
);
...
...
@@ -266,13 +268,12 @@ static void Render( vout_thread_t *p_vout, picture_t *p_pic,
case VLC_FOURCC('R','V','1','6'):
RenderRV16( p_vout, p_pic, p_subpic );
break;
#endif
/* RV32 target, scaling */
case
VLC_FOURCC
(
'R'
,
'V'
,
'2'
,
'4'
):
case
VLC_FOURCC
(
'R'
,
'V'
,
'3'
,
'2'
):
RenderRV32
(
p_vout
,
p_pic
,
p_subpic
);
break
;
#endif
/* NVidia or BeOS overlay, no scaling */
case
VLC_FOURCC
(
'Y'
,
'U'
,
'Y'
,
'2'
):
RenderYUY2
(
p_vout
,
p_pic
,
p_subpic
);
...
...
@@ -335,7 +336,7 @@ static void RenderI420( vout_thread_t *p_vout, picture_t *p_pic,
{
FT_BitmapGlyph
p_glyph
=
p_line
->
pp_glyphs
[
i
];
#define alpha p_vout->p_text_renderer_data->pi_gamma[ p_glyph->bitmap.buffer[ x + y * p_glyph->bitmap.width ] ]
#define pixel p_in[ ( p_line->p_glyph_pos[ i ].y + pen_y + y - p_glyph->top ) * i_pitch
+
x + pen_x + p_line->p_glyph_pos[ i ].x + p_glyph->left ]
#define pixel p_in[ ( p_line->p_glyph_pos[ i ].y + pen_y + y - p_glyph->top ) * i_pitch
+
x + pen_x + p_line->p_glyph_pos[ i ].x + p_glyph->left ]
for
(
y
=
0
;
y
<
p_glyph
->
bitmap
.
rows
;
y
++
)
{
for
(
x
=
0
;
x
<
p_glyph
->
bitmap
.
width
;
x
++
)
...
...
@@ -458,6 +459,73 @@ static void RenderYUY2( vout_thread_t *p_vout, picture_t *p_pic,
}
}
/**
* Draw a string on a RV32 picture
*/
static
void
RenderRV32
(
vout_thread_t
*
p_vout
,
picture_t
*
p_pic
,
const
subpicture_t
*
p_subpic
)
{
subpicture_sys_t
*
p_string
=
p_subpic
->
p_sys
;
int
i_plane
,
x
,
y
,
pen_x
,
pen_y
;
unsigned
int
i
;
line_desc_t
*
p_line
;
i_plane
=
0
;
for
(
p_line
=
p_subpic
->
p_sys
->
p_lines
;
p_line
!=
NULL
;
p_line
=
p_line
->
p_next
)
{
uint8_t
*
p_in
;
int
i_pitch
=
p_pic
->
p
[
i_plane
].
i_pitch
;
p_in
=
p_pic
->
p
[
i_plane
].
p_pixels
;
if
(
p_string
->
i_flags
&
OSD_ALIGN_BOTTOM
)
{
pen_y
=
p_pic
->
p
[
i_plane
].
i_lines
-
p_string
->
i_height
-
p_string
->
i_y_margin
;
}
else
{
pen_y
=
p_string
->
i_y_margin
;
}
pen_y
+=
p_vout
->
p_text_renderer_data
->
p_face
->
size
->
metrics
.
ascender
>>
6
;
if
(
p_string
->
i_flags
&
OSD_ALIGN_RIGHT
)
{
pen_x
=
i_pitch
-
p_line
->
i_width
-
p_string
->
i_x_margin
;
}
else
if
(
p_string
->
i_flags
&
OSD_ALIGN_LEFT
)
{
pen_x
=
p_string
->
i_x_margin
;
}
else
{
pen_x
=
i_pitch
/
2
-
p_line
->
i_width
/
2
+
p_string
->
i_x_margin
;
}
for
(
i
=
0
;
p_line
->
pp_glyphs
[
i
]
!=
NULL
;
i
++
)
{
FT_BitmapGlyph
p_glyph
=
p_line
->
pp_glyphs
[
i
];
#define alpha p_vout->p_text_renderer_data->pi_gamma[ p_glyph->bitmap.buffer[ x + y * p_glyph->bitmap.width ] ]
#define pixel( c ) p_in[ ( p_line->p_glyph_pos[ i ].y + pen_y + y - p_glyph->top ) * i_pitch + ( x + pen_x + p_line->p_glyph_pos[ i ].x + p_glyph->left ) * 4 + c ]
for
(
y
=
0
;
y
<
p_glyph
->
bitmap
.
rows
;
y
++
)
{
for
(
x
=
0
;
x
<
p_glyph
->
bitmap
.
width
;
x
++
)
{
pixel
(
0
)
=
(
(
pixel
(
0
)
*
(
255
-
alpha
)
)
>>
8
)
+
(
255
*
alpha
>>
8
);
pixel
(
1
)
=
(
(
pixel
(
1
)
*
(
255
-
alpha
)
)
>>
8
)
+
(
255
*
alpha
>>
8
);
pixel
(
2
)
=
(
(
pixel
(
2
)
*
(
255
-
alpha
)
)
>>
8
)
+
(
255
*
alpha
>>
8
);
#undef alpha
#undef pixel
}
}
}
}
}
/**
* This function receives a string and creates a subpicture for it. It
...
...
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