Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
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-1.1
Commits
41e4d5d7
Commit
41e4d5d7
authored
Jul 26, 2003
by
Eric Petit
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
freetype.c: basic YUY2 rendering (Y only)
parent
5754f347
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
66 additions
and
7 deletions
+66
-7
modules/misc/freetype.c
modules/misc/freetype.c
+66
-7
No files found.
modules/misc/freetype.c
View file @
41e4d5d7
...
...
@@ -2,7 +2,7 @@
* freetype.c : Put text on the video, using freetype2
*****************************************************************************
* Copyright (C) 2002, 2003 VideoLAN
* $Id: freetype.c,v 1.1
3 2003/07/24 21:50:28 gbazin
Exp $
* $Id: freetype.c,v 1.1
4 2003/07/26 18:54:20 titer
Exp $
*
* Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
*
...
...
@@ -54,6 +54,8 @@ static void Render ( vout_thread_t *, picture_t *,
const
subpicture_t
*
);
static
void
RenderI420
(
vout_thread_t
*
,
picture_t
*
,
const
subpicture_t
*
);
static
void
RenderYUY2
(
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
int
GetUnicodeCharFromUTF8
(
byte_t
**
);
...
...
@@ -248,20 +250,20 @@ static void Render( vout_thread_t *p_vout, picture_t *p_pic,
#if 0
/* RV16 target, scaling */
case VLC_FOURCC('R','V','1','6'):
RenderRV16( p_vout, p_pic, p_s
pu, p_spu->p_sys->b_crop
);
RenderRV16( p_vout, p_pic, p_s
ubpic
);
break;
/* RV32 target, scaling */
case VLC_FOURCC('R','V','2','4'):
case VLC_FOURCC('R','V','3','2'):
RenderRV32( p_vout, p_pic, p_s
pu, p_spu->p_sys->b_crop
);
RenderRV32( p_vout, p_pic, p_s
ubpic
);
break;
/* NVidia overlay, no scaling */
#endif
/* NVidia o
r BeOS o
verlay, no scaling */
case
VLC_FOURCC
(
'Y'
,
'U'
,
'Y'
,
'2'
):
RenderYUY2( p_vout, p_pic, p_s
pu, p_spu->p_sys->b_crop
);
RenderYUY2
(
p_vout
,
p_pic
,
p_s
ubpic
);
break
;
#endif
default:
msg_Err
(
p_vout
,
"unknown chroma, can't render SPU"
);
break
;
...
...
@@ -372,6 +374,63 @@ static void RenderI420( vout_thread_t *p_vout, picture_t *p_pic,
}
}
/**
* Draw a string on a YUY2 picture
*/
static
void
RenderYUY2
(
vout_thread_t
*
p_vout
,
picture_t
*
p_pic
,
const
subpicture_t
*
p_subpic
)
{
subpicture_sys_t
*
p_string
=
p_subpic
->
p_sys
;
int
x
,
y
,
pen_x
,
pen_y
;
unsigned
int
i
;
uint8_t
*
p_in
;
int
i_pitch
=
p_pic
->
p
[
0
].
i_pitch
;
p_in
=
p_pic
->
p
->
p_pixels
;
if
(
p_string
->
i_flags
&
OSD_ALIGN_BOTTOM
)
{
pen_y
=
p_pic
->
p
->
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
.
height
/
100
;
if
(
p_string
->
i_flags
&
OSD_ALIGN_RIGHT
)
{
pen_x
=
i_pitch
-
p_string
->
i_width
-
p_string
->
i_x_margin
;
}
else
{
pen_x
=
p_string
->
i_x_margin
;
}
/* TODO : set U & V bytes */
for
(
i
=
0
;
p_string
->
pp_glyphs
[
i
]
!=
NULL
;
i
++
)
{
if
(
p_string
->
pp_glyphs
[
i
]
)
{
FT_BitmapGlyph
p_glyph
=
p_string
->
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_string->p_glyph_pos[ i ].y + pen_y + y - p_glyph->top ) * i_pitch + 2 * ( x + pen_x + p_string->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
++
)
{
pixel
=
(
(
pixel
*
(
255
-
alpha
)
)
>>
8
)
+
(
255
*
alpha
>>
8
);
#undef alpha
#undef pixel
}
}
}
}
}
/**
* This function receives a string and creates a subpicture for it. It
* also calculates the size needed for this string, and renders the
...
...
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