Commit 4f553677 authored by Vincent Seguin's avatar Vincent Seguin

IMPORTANT:

	p_vout->i_depth est maintenant la profondeur SIGNIFICATIVE de
		l'�cran (8, 15, 16 ou 24)
	p_vout->i_bytes_per_pixel est la profondeur r�elle (1, 2, 3 ou 4)

Ajout du calcul des d�calages � video_output.
Refonte de l'initialisation des tables.
D�tection correcte des profondeurs 24/24 et 24/32 en X11
Correction de bugs dans le scaling en 1, 3 et 4 Bpp.
R�cup�ration des masques depuis le materiel en X11 et GGI.

FrameBuffer cass� pour le moment: il faut rajouter les masques de couleur
(des valeurs par d�faut sont au d�but de video_yuv.c) et le calcul des
nouvelles profondeurs d'�cran.
parent fb0eb672
......@@ -103,10 +103,27 @@ typedef struct vout_thread_s
int i_width; /* current output method width */
int i_height; /* current output method height */
int i_bytes_per_line; /* bytes per line (incl. virtual) */
int i_screen_depth; /* bits per pixel */
int i_bytes_per_pixel; /* real screen depth */
int i_screen_depth; /* significant bpp: 8, 15, 16 or 24 */
int i_bytes_per_pixel; /* real screen depth: 1, 2, 3 or 4 */
float f_gamma; /* gamma */
/* Color masks and shifts in RGB mode - masks are set by system
* initialization, shifts are calculated. A pixel color value can be
* obtained using the formula ((value >> rshift) << lshift) */
u32 i_red_mask; /* red mask */
u32 i_green_mask; /* green mask */
u32 i_blue_mask; /* blue mask */
int i_red_lshift, i_red_rshift; /* red shifts */
int i_green_lshift, i_green_rshift; /* green shifts */
int i_blue_lshift, i_blue_rshift; /* blue shifts */
/* Usefull pre-calculated pixel values - these are not supposed to be
* accurate values, but rather values looking nice, given their usage. */
u32 i_white_pixel; /* white */
u32 i_black_pixel; /* black */
u32 i_gray_pixel; /* gray */
u32 i_blue_pixel; /* blue */
/* Pictures and rendering properties */
boolean_t b_grayscale; /* color or grayscale display */
boolean_t b_info; /* print additionnal informations */
......@@ -151,6 +168,17 @@ typedef struct vout_thread_s
#define VOUT_YUV_CHANGE 0x0800 /* change yuv tables */
#define VOUT_NODISPLAY_CHANGE 0xff00 /* changes which forbidden display */
/*******************************************************************************
* Macros
*******************************************************************************/
/* RGB2PIXEL: assemble RGB components to a pixel value, returns a u32 */
#define RGB2PIXEL( p_vout, i_red, i_green, i_blue ) \
(((((u32)i_red) >> p_vout->i_red_rshift) << p_vout->i_red_lshift) | \
((((u32)i_green) >> p_vout->i_green_rshift) << p_vout->i_green_lshift) | \
((((u32)i_blue) >> p_vout->i_blue_rshift) << p_vout->i_blue_lshift))
/*******************************************************************************
* Prototypes
*******************************************************************************/
......@@ -169,3 +197,4 @@ void vout_DestroySubPicture ( vout_thread_t *p_vout, subpicture_t *p
void vout_DisplaySubPicture ( vout_thread_t *p_vout, subpicture_t *p_subpic );
void vout_SetBuffers ( vout_thread_t *p_vout, void *p_buf1, void *p_buf2 );
......@@ -119,6 +119,7 @@ void vout_SysDestroy( vout_thread_t *p_vout )
*******************************************************************************/
int vout_SysManage( vout_thread_t *p_vout )
{
//?? 8bpp: change palette
return( 0 );
}
......@@ -286,32 +287,13 @@ static int GGIOpenDisplay( vout_thread_t *p_vout, char *psz_display )
p_vout->i_width = mode.visible.x;
p_vout->i_height = mode.visible.y;
p_vout->i_bytes_per_line = p_vout->p_sys->p_buffer[ 0 ]->buffer.plb.stride;
switch( mode.graphtype )
{
case GT_15BIT:
p_vout->i_screen_depth = 15;
p_vout->i_bytes_per_pixel = 2;
break;
case GT_16BIT:
p_vout->i_screen_depth = 16;
p_vout->i_bytes_per_pixel = 2;
break;
case GT_24BIT:
p_vout->i_screen_depth = 24;
p_vout->i_bytes_per_pixel = 3;
break;
case GT_32BIT:
p_vout->i_screen_depth = 32;
p_vout->i_bytes_per_pixel = 4;
break;
default:
intf_ErrMsg("error: unsupported screen depth\n");
ggiClose( p_vout->p_sys->p_display );
ggiExit();
return( 1 );
break;
}
p_vout->i_screen_depth = p_vout->p_sys->p_buffer[ 0 ]->buffer.plb->pixelformat.depth;
p_vout->i_bytes_per_pixel = p_vout->p_sys->p_buffer[ 0 ]->buffer.plb->pixelformat.size / 8;
p_vout->i_red_mask = p_vout->p_sys->p_buffer[ 0 ]->buffer.plb->pixelformat.red_mask;
p_vout->i_green_mask = p_vout->p_sys->p_buffer[ 0 ]->buffer.plb->pixelformat.green_mask;
p_vout->i_blue_mask = p_vout->p_sys->p_buffer[ 0 ]->buffer.plb->pixelformat.blue_mask;
//?? palette in 8bpp
/* Set and initialize buffers */
vout_SetBuffers( p_vout, p_vout->p_sys->p_buffer[ 0 ]->write, p_vout->p_sys->p_buffer[ 1 ]->write );
......
This diff is collapsed.
......@@ -60,8 +60,9 @@ typedef void (vout_put_byte_t)( void *p_pic, int i_byte, int i_char, int i_borde
*******************************************************************************/
/* PUT_BYTE_MASK: put pixels from a byte-wide mask. It uses a branching tree
* to optimize the number of tests. It is used in the PutByte functions. */
#define TREE( i_mask, i_mask_color ) \
* to optimize the number of tests. It is used in the PutByte functions.
* This macro works for 1, 2 and 4 Bpp. */
#define PUT_BYTE_MASK( i_mask, i_mask_color ) \
if( i_mask & 0xf0 ) /* one from 1111 */ \
{ \
if( i_mask & 0xc0 ) /* one from 1100 */ \
......@@ -364,17 +365,9 @@ void vout_Print( vout_font_t *p_font, byte_t *p_pic, int i_bytes_per_pixel, int
p_PutByte = (vout_put_byte_t *) PutByte24;
break;
case 4:
#ifndef DEBUG
default:
#endif
p_PutByte = (vout_put_byte_t *) PutByte32;
break;
#ifdef DEBUG
default:
intf_DbgMsg("error: invalid bytes per pixel %d\n", i_bytes_per_pixel );
p_PutByte = NULL;
break;
#endif
}
/* Choose masks and copy font data to local variables */
......@@ -447,7 +440,7 @@ void vout_Print( vout_font_t *p_font, byte_t *p_pic, int i_bytes_per_pixel, int
/* following functions are local */
/*****************************************************************************
* PutByte8: print a fixed width font character byte in 15 or 16 bpp
* PutByte8: print a fixed width font character byte in 1 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,
......@@ -458,13 +451,13 @@ static void PutByte8( u8 *p_pic, int i_byte, int i_char, int i_border,
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);
PUT_BYTE_MASK(i_char, i_char_color);
PUT_BYTE_MASK(i_border, i_border_color);
PUT_BYTE_MASK(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 2 Bpp
*****************************************************************************/
static void PutByte16( u16 *p_pic, int i_byte, int i_char, int i_border,
int i_bg, u32 i_char_color, u32 i_border_color,
......@@ -475,13 +468,13 @@ static void PutByte16( u16 *p_pic, int i_byte, int i_char, int i_border,
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);
PUT_BYTE_MASK(i_char, i_char_color);
PUT_BYTE_MASK(i_border, i_border_color);
PUT_BYTE_MASK(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 3 Bpp
*****************************************************************************/
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 )
......@@ -490,7 +483,7 @@ static void PutByte24( void *p_pic, int i_byte, byte_t i_char, byte_t i_border,
}
/*****************************************************************************
* PutByte32: print a fixed width font character byte in 32 bpp
* PutByte32: print a fixed width font character byte in 4 Bpp
*****************************************************************************/
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 )
......@@ -500,8 +493,8 @@ static void PutByte32( u32 *p_pic, int i_byte, byte_t i_char, byte_t i_border, b
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);
PUT_BYTE_MASK(i_char, i_char_color);
PUT_BYTE_MASK(i_border, i_border_color);
PUT_BYTE_MASK(i_bg, i_bg_color);
}
This diff is collapsed.
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