Commit fb0eb672 authored by Sam Hocevar's avatar Sam Hocevar

. prototypes de fonctions pour le 8bpp

 . virage d'un bug dans le calcul de bytes_per_line (sauf fumage de ma part)
 . suppression de quelques #@@#@!!#@@#!@#@#! d'espaces en fin de ligne
 . quelques reformatages � 79 colonnes au lieu de @@#@!!#@@#!@#@#!# 81.
parent 5017b466
...@@ -44,8 +44,10 @@ typedef struct vout_yuv_s ...@@ -44,8 +44,10 @@ typedef struct vout_yuv_s
void * p_base; /* base for all convertion tables */ void * p_base; /* base for all convertion tables */
union union
{ {
u8 * p_gray8; /* gray 8 bits table */
u16 * p_gray16; /* gray 16 bits table */ u16 * p_gray16; /* gray 16 bits table */
u32 * p_gray32; /* gray 32 bits table */ u32 * p_gray32; /* gray 32 bits table */
u8 * p_rgb8; /* RGB 8 bits table */
u16 * p_rgb16; /* RGB 16 bits table */ u16 * p_rgb16; /* RGB 16 bits table */
u32 * p_rgb32; /* RGB 32 bits table */ u32 * p_rgb32; /* RGB 32 bits table */
} yuv; } yuv;
...@@ -100,7 +102,7 @@ typedef struct vout_thread_s ...@@ -100,7 +102,7 @@ typedef struct vout_thread_s
u16 i_changes; /* changes made to the thread */ u16 i_changes; /* changes made to the thread */
int i_width; /* current output method width */ int i_width; /* current output method width */
int i_height; /* current output method height */ int i_height; /* current output method height */
int i_bytes_per_line;/* bytes per line (including virtual) */ int i_bytes_per_line; /* bytes per line (incl. virtual) */
int i_screen_depth; /* bits per pixel */ int i_screen_depth; /* bits per pixel */
int i_bytes_per_pixel; /* real screen depth */ int i_bytes_per_pixel; /* real screen depth */
float f_gamma; /* gamma */ float f_gamma; /* gamma */
...@@ -120,7 +122,7 @@ typedef struct vout_thread_s ...@@ -120,7 +122,7 @@ typedef struct vout_thread_s
* good indication of the thread status */ * good indication of the thread status */
mtime_t render_time; /* last picture render time */ mtime_t render_time; /* last picture render time */
count_t c_fps_samples; /* picture counts */ count_t c_fps_samples; /* picture counts */
mtime_t p_fps_sample[ VOUT_FPS_SAMPLES ]; /* FPS samples dates */ mtime_t p_fps_sample[ VOUT_FPS_SAMPLES ];/* FPS samples dates */
#endif #endif
/* Rendering buffers */ /* Rendering buffers */
......
...@@ -199,21 +199,28 @@ static int FBOpenDisplay( vout_thread_t *p_vout ) ...@@ -199,21 +199,28 @@ static int FBOpenDisplay( vout_thread_t *p_vout )
p_vout->i_width = p_vout->p_sys->var_info.xres; p_vout->i_width = p_vout->p_sys->var_info.xres;
p_vout->i_height = p_vout->p_sys->var_info.yres; p_vout->i_height = p_vout->p_sys->var_info.yres;
p_vout->i_bytes_per_line = p_vout->i_width * 2;
p_vout->i_screen_depth = p_vout->p_sys->var_info.bits_per_pixel; p_vout->i_screen_depth = p_vout->p_sys->var_info.bits_per_pixel;
switch( p_vout->i_screen_depth ) switch( p_vout->i_screen_depth )
{ {
case 8: /* 8 bpp */
p_vout->i_bytes_per_pixel = 1;
p_vout->i_bytes_per_line = p_vout->i_width;
break;
case 15: /* 15 bpp (16bpp with a missing green bit) */ case 15: /* 15 bpp (16bpp with a missing green bit) */
case 16: /* 16 bpp (65536 colors) */ case 16: /* 16 bpp (65536 colors) */
p_vout->i_bytes_per_pixel = 2; p_vout->i_bytes_per_pixel = 2;
p_vout->i_bytes_per_line = p_vout->i_width * 2;
break; break;
case 24: /* 24 bpp (millions of colors) */ case 24: /* 24 bpp (millions of colors) */
p_vout->i_bytes_per_pixel = 3; p_vout->i_bytes_per_pixel = 3;
p_vout->i_bytes_per_line = p_vout->i_width * 3;
break; break;
case 32: /* 32 bpp (millions of colors) */ case 32: /* 32 bpp (millions of colors) */
p_vout->i_bytes_per_pixel = 4; p_vout->i_bytes_per_pixel = 4;
p_vout->i_bytes_per_line = p_vout->i_width * 4;
break; break;
default: /* unsupported screen depth */ default: /* unsupported screen depth */
...@@ -256,3 +263,4 @@ static void FBCloseDisplay( vout_thread_t *p_vout ) ...@@ -256,3 +263,4 @@ static void FBCloseDisplay( vout_thread_t *p_vout )
// Destroy window and close display // Destroy window and close display
close( p_vout->p_sys->i_fb_dev ); close( p_vout->p_sys->i_fb_dev );
} }
...@@ -36,18 +36,22 @@ static void ErrorThread ( vout_thread_t *p_vout ); ...@@ -36,18 +36,22 @@ static void ErrorThread ( vout_thread_t *p_vout );
static void EndThread ( vout_thread_t *p_vout ); static void EndThread ( vout_thread_t *p_vout );
static void DestroyThread ( vout_thread_t *p_vout, int i_status ); static void DestroyThread ( vout_thread_t *p_vout, int i_status );
static void Print ( vout_thread_t *p_vout, int i_x, int i_y, static void Print ( vout_thread_t *p_vout, int i_x, int i_y,
int i_h_align, int i_v_align, unsigned char *psz_text ); int i_h_align, int i_v_align,
static void SetBufferArea ( vout_thread_t *p_vout, int i_x, int i_y, int i_w, int i_h ); unsigned char *psz_text );
static void SetBufferArea ( vout_thread_t *p_vout, int i_x, int i_y,
int i_w, int i_h );
static void SetBufferPicture ( vout_thread_t *p_vout, picture_t *p_pic ); static void SetBufferPicture ( vout_thread_t *p_vout, picture_t *p_pic );
static void RenderPicture ( vout_thread_t *p_vout, picture_t *p_pic ); static void RenderPicture ( vout_thread_t *p_vout, picture_t *p_pic );
static void RenderPictureInfo ( vout_thread_t *p_vout, picture_t *p_pic ); static void RenderPictureInfo ( vout_thread_t *p_vout, picture_t *p_pic );
static void RenderSubPicture ( vout_thread_t *p_vout, subpicture_t *p_subpic ); static void RenderSubPicture ( vout_thread_t *p_vout,
subpicture_t *p_subpic );
static void RenderInterface ( vout_thread_t *p_vout ); static void RenderInterface ( vout_thread_t *p_vout );
static int RenderIdle ( vout_thread_t *p_vout ); static int RenderIdle ( vout_thread_t *p_vout );
static void RenderInfo ( vout_thread_t *p_vout ); static void RenderInfo ( vout_thread_t *p_vout );
static int Manage ( vout_thread_t *p_vout ); static int Manage ( vout_thread_t *p_vout );
static int Align ( vout_thread_t *p_vout, int *pi_x, int *pi_y, static int Align ( vout_thread_t *p_vout, int *pi_x,
int i_width, int i_height, int i_h_align, int i_v_align ); int *pi_y, int i_width, int i_height,
int i_h_align, int i_v_align );
/****************************************************************************** /******************************************************************************
* vout_CreateThread: creates a new video output thread * vout_CreateThread: creates a new video output thread
......
...@@ -159,22 +159,28 @@ if( i_mask & 0x0f ) ...@@ -159,22 +159,28 @@ if( i_mask & 0x0f )
} \ } \
} }
/******************************************************************************* /*****************************************************************************
* Local prototypes * Local prototypes
*******************************************************************************/ *****************************************************************************/
static void PutByte16( u16 *p_pic, int i_byte, int i_char, int i_border, int i_bg, static void PutByte8 ( u8 *p_pic, int i_byte, int i_char, int i_border,
u32 i_char_color, u32 i_border_color, u32 i_bg_color ); int i_bg, u32 i_char_color, u32 i_border_color,
static void PutByte24( void *p_pic, int i_byte, byte_t i_char, byte_t i_border, byte_t i_bg, u32 i_bg_color );
u32 i_char_color, u32 i_border_color, u32 i_bg_color ); static void PutByte16( u16 *p_pic, int i_byte, int i_char, int i_border,
static void PutByte32( u32 *p_pic, int i_byte, byte_t i_char, byte_t i_border, byte_t i_bg, int i_bg, u32 i_char_color, u32 i_border_color,
u32 i_char_color, u32 i_border_color, u32 i_bg_color ); u32 i_bg_color );
static void PutByte24( void *p_pic, int i_byte, byte_t i_char, byte_t i_border,
/******************************************************************************* byte_t i_bg, u32 i_char_color, u32 i_border_color,
u32 i_bg_color );
static void PutByte32( u32 *p_pic, int i_byte, byte_t i_char, byte_t i_border,
byte_t i_bg, u32 i_char_color, u32 i_border_color,
u32 i_bg_color );
/*****************************************************************************
* vout_LoadFont: load a bitmap font from a file * vout_LoadFont: load a bitmap font from a file
******************************************************************************* *****************************************************************************
* This function will try to open a .psf font and load it. It will return * This function will try to open a .psf font and load it. It will return
* NULL on error. * NULL on error.
*******************************************************************************/ *****************************************************************************/
vout_font_t *vout_LoadFont( const char *psz_name ) vout_font_t *vout_LoadFont( const char *psz_name )
{ {
int i_char, i_line; /* character and line indexes */ int i_char, i_line; /* character and line indexes */
...@@ -348,6 +354,9 @@ void vout_Print( vout_font_t *p_font, byte_t *p_pic, int i_bytes_per_pixel, int ...@@ -348,6 +354,9 @@ void vout_Print( vout_font_t *p_font, byte_t *p_pic, int i_bytes_per_pixel, int
/* Select output function */ /* Select output function */
switch( i_bytes_per_pixel ) switch( i_bytes_per_pixel )
{ {
case 1:
p_PutByte = (vout_put_byte_t *) PutByte8;
break;
case 2: case 2:
p_PutByte = (vout_put_byte_t *) PutByte16; p_PutByte = (vout_put_byte_t *) PutByte16;
break; break;
...@@ -437,11 +446,29 @@ void vout_Print( vout_font_t *p_font, byte_t *p_pic, int i_bytes_per_pixel, int ...@@ -437,11 +446,29 @@ void vout_Print( vout_font_t *p_font, byte_t *p_pic, int i_bytes_per_pixel, int
/* following functions are local */ /* following functions are local */
/******************************************************************************* /*****************************************************************************
* PutByte8: print a fixed width font character byte in 15 or 16 bpp
*****************************************************************************/
static void PutByte8( u8 *p_pic, int i_byte, int i_char, int i_border,
int i_bg, u32 i_char_color, u32 i_border_color,
u32 i_bg_color )
{
/* Computes position offset and background mask */
p_pic += 8 * i_byte;
i_bg &= ~(i_char | i_border);
/* Put character bits */
TREE(i_char, i_char_color);
TREE(i_border, i_border_color);
TREE(i_bg, i_bg_color);
}
/*****************************************************************************
* PutByte16: print a fixed width font character byte in 15 or 16 bpp * PutByte16: print a fixed width font character byte in 15 or 16 bpp
*******************************************************************************/ *****************************************************************************/
static void PutByte16( u16 *p_pic, int i_byte, int i_char, int i_border, int i_bg, static void PutByte16( u16 *p_pic, int i_byte, int i_char, int i_border,
u32 i_char_color, u32 i_border_color, u32 i_bg_color ) int i_bg, u32 i_char_color, u32 i_border_color,
u32 i_bg_color )
{ {
/* Computes position offset and background mask */ /* Computes position offset and background mask */
p_pic += 8 * i_byte; p_pic += 8 * i_byte;
...@@ -453,18 +480,18 @@ static void PutByte16( u16 *p_pic, int i_byte, int i_char, int i_border, int i_b ...@@ -453,18 +480,18 @@ static void PutByte16( u16 *p_pic, int i_byte, int i_char, int i_border, int i_b
TREE(i_bg, i_bg_color); TREE(i_bg, i_bg_color);
} }
/******************************************************************************* /*****************************************************************************
* PutByte24: print a fixed width font character byte in 24 bpp * PutByte24: print a fixed width font character byte in 24 bpp
*******************************************************************************/ *****************************************************************************/
static void PutByte24( void *p_pic, int i_byte, byte_t i_char, byte_t i_border, byte_t i_bg, static void PutByte24( void *p_pic, int i_byte, byte_t i_char, byte_t i_border, byte_t i_bg,
u32 i_char_color, u32 i_border_color, u32 i_bg_color ) u32 i_char_color, u32 i_border_color, u32 i_bg_color )
{ {
//?? //??
} }
/******************************************************************************* /*****************************************************************************
* PutByte32: print a fixed width font character byte in 32 bpp * PutByte32: print a fixed width font character byte in 32 bpp
*******************************************************************************/ *****************************************************************************/
static void PutByte32( u32 *p_pic, int i_byte, byte_t i_char, byte_t i_border, byte_t i_bg, static void PutByte32( u32 *p_pic, int i_byte, byte_t i_char, byte_t i_border, byte_t i_bg,
u32 i_char_color, u32 i_border_color, u32 i_bg_color ) u32 i_char_color, u32 i_border_color, u32 i_bg_color )
{ {
......
...@@ -295,6 +295,9 @@ static int X11OpenDisplay( vout_thread_t *p_vout, char *psz_display, Window root ...@@ -295,6 +295,9 @@ static int X11OpenDisplay( vout_thread_t *p_vout, char *psz_display, Window root
p_vout->p_sys->i_screen ); p_vout->p_sys->i_screen );
switch( p_vout->i_screen_depth ) switch( p_vout->i_screen_depth )
{ {
case 8: /* 24 bpp (millions of colors) */
p_vout->i_bytes_per_pixel = 1;
break;
case 15: /* 15 bpp (16bpp with a missing green bit) */ case 15: /* 15 bpp (16bpp with a missing green bit) */
case 16: /* 16 bpp (65536 colors) */ case 16: /* 16 bpp (65536 colors) */
p_vout->i_bytes_per_pixel = 2; p_vout->i_bytes_per_pixel = 2;
......
This diff is collapsed.
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