Commit d2c52a32 authored by Olivier Teulière's avatar Olivier Teulière

* modules/misc/freetype.c: compilation fix for windows

parent e9e2c245
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* freetype.c : Put text on the video, using freetype2 * freetype.c : Put text on the video, using freetype2
***************************************************************************** *****************************************************************************
* Copyright (C) 2002, 2003 VideoLAN * Copyright (C) 2002, 2003 VideoLAN
* $Id: freetype.c,v 1.4 2003/07/20 16:26:33 sigmunau Exp $ * $Id: freetype.c,v 1.5 2003/07/20 16:56:58 ipkiss Exp $
* *
* Authors: Sigmund Augdal <sigmunau@idi.ntnu.no> * Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
* *
...@@ -36,8 +36,6 @@ ...@@ -36,8 +36,6 @@
#include FT_FREETYPE_H #include FT_FREETYPE_H
#include FT_GLYPH_H #include FT_GLYPH_H
#define FT_RENDER_MODE_NORMAL 0 /* Why do we have to do that ? */
/***************************************************************************** /*****************************************************************************
* Local prototypes * Local prototypes
*****************************************************************************/ *****************************************************************************/
...@@ -161,7 +159,7 @@ static int Create( vlc_object_t *p_this ) ...@@ -161,7 +159,7 @@ static int Create( vlc_object_t *p_this )
return VLC_EGENERIC; return VLC_EGENERIC;
} }
i_error = FT_Select_Charmap( p_vout->p_text_renderer_data->p_face, i_error = FT_Select_Charmap( p_vout->p_text_renderer_data->p_face,
FT_ENCODING_UNICODE ); ft_encoding_unicode );
if ( i_error ) if ( i_error )
{ {
msg_Err( p_vout, "Font has no unicode translation table" ); msg_Err( p_vout, "Font has no unicode translation table" );
...@@ -171,7 +169,8 @@ static int Create( vlc_object_t *p_this ) ...@@ -171,7 +169,8 @@ static int Create( vlc_object_t *p_this )
return VLC_EGENERIC; return VLC_EGENERIC;
} }
p_vout->p_text_renderer_data->i_use_kerning = FT_HAS_KERNING(p_vout->p_text_renderer_data->p_face); p_vout->p_text_renderer_data->i_use_kerning =
FT_HAS_KERNING(p_vout->p_text_renderer_data->p_face);
i_error = FT_Set_Pixel_Sizes( p_vout->p_text_renderer_data->p_face, 0, i_error = FT_Set_Pixel_Sizes( p_vout->p_text_renderer_data->p_face, 0,
config_GetInt( p_vout, "freetype-fontsize" ) ); config_GetInt( p_vout, "freetype-fontsize" ) );
...@@ -323,7 +322,7 @@ static void RenderI420( vout_thread_t *p_vout, picture_t *p_pic, ...@@ -323,7 +322,7 @@ static void RenderI420( vout_thread_t *p_vout, picture_t *p_pic,
FT_BitmapGlyph p_glyph = 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 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>>1) + pen_y + (y>>1) - ( p_glyph->top >> 1 ) ) * i_pitch + ( x >> 1 ) + pen_x + ( p_string->p_glyph_pos[ i ].x >> 1 ) + ( p_glyph->left >>1) ] #define pixel p_in[ ( (p_string->p_glyph_pos[ i ].y>>1) + pen_y + (y>>1) - ( p_glyph->top >> 1 ) ) * i_pitch + ( x >> 1 ) + pen_x + ( p_string->p_glyph_pos[ i ].x >> 1 ) + ( p_glyph->left >>1) ]
for(y = 0; y < p_glyph->bitmap.rows; y+=2 ) for( y = 0; y < p_glyph->bitmap.rows; y+=2 )
{ {
for( x = 0; x < p_glyph->bitmap.width; x+=2 ) for( x = 0; x < p_glyph->bitmap.width; x+=2 )
{ {
...@@ -462,7 +461,7 @@ static int AddText ( vout_thread_t *p_vout, byte_t *psz_string, ...@@ -462,7 +461,7 @@ static int AddText ( vout_thread_t *p_vout, byte_t *psz_string,
} }
FT_Glyph_Get_CBox( tmp_glyph, ft_glyph_bbox_pixels, &glyph_size ); FT_Glyph_Get_CBox( tmp_glyph, ft_glyph_bbox_pixels, &glyph_size );
i_error = FT_Glyph_To_Bitmap( &tmp_glyph, i_error = FT_Glyph_To_Bitmap( &tmp_glyph,
FT_RENDER_MODE_NORMAL, ft_render_mode_normal,
&p_string->p_glyph_pos[i], &p_string->p_glyph_pos[i],
1 ); 1 );
if ( i_error ) continue; if ( i_error ) continue;
...@@ -482,7 +481,8 @@ static int AddText ( vout_thread_t *p_vout, byte_t *psz_string, ...@@ -482,7 +481,8 @@ static int AddText ( vout_thread_t *p_vout, byte_t *psz_string,
result.y += line.yMax - line.yMin; result.y += line.yMax - line.yMin;
p_string->i_height = result.y; p_string->i_height = result.y;
p_string->i_width = result.x; p_string->i_width = result.x;
msg_Dbg( p_vout, "string height is %d, width is %d", p_string->i_height, p_string->i_width ); msg_Dbg( p_vout, "string height is %d, width is %d",
p_string->i_height, p_string->i_width );
msg_Dbg( p_vout, "adding string \"%s\" at (%d,%d) start_date "I64Fd msg_Dbg( p_vout, "adding string \"%s\" at (%d,%d) start_date "I64Fd
" end_date" I64Fd, p_string->psz_text, p_string->i_x_margin, " end_date" I64Fd, p_string->psz_text, p_string->i_x_margin,
p_string->i_y_margin, i_start, i_stop ); p_string->i_y_margin, i_start, i_stop );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment