-/*****************************************************************************
- * vout_put_byte_t: PutByte function
- *****************************************************************************
- * These functions will transform masks in a set of pixels. For each pixel,
- * character, then border and background masks are tested, and the first
- * encountered color is set.
- *****************************************************************************/
-typedef void (vout_put_byte_t)( void *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 );
-
-
-/*****************************************************************************
- * Macros
- *****************************************************************************/
-
-/* 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.
- * 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 */ \
- { \
- if( i_mask & 0x80 ) /* 1000 */ \
- { \
- p_pic[0] = i_mask_color; \
- if( i_mask & 0x40 ) /* 0100 */ \
- { \
- p_pic[1] = i_mask_color; \
- } \
- } \
- else /* not 1000 means 0100 */ \
- { \
- p_pic[1] = i_mask_color; \
- } \
- if( i_mask & 0x30 ) /* one from 0011 */ \
- { \
- if( i_mask & 0x20 ) /* 0010 */ \
- { \
- p_pic[2] = i_mask_color; \
- if( i_mask & 0x10 ) /* 0001 */ \
- { \
- p_pic[3] = i_mask_color; \
- } \
- } \
- else /* not 0010 means 0001 */ \
- { \
- p_pic[3] = i_mask_color; \
- } \
- } \
- } \
- else /* not 1100 means 0011 */ \
- { \
- if( i_mask & 0x20 ) /* 0010 */ \
- { \
- p_pic[2] = i_mask_color; \
- if( i_mask & 0x10 ) /* 0001 */ \
- { \
- p_pic[3] = i_mask_color; \
- } \
- } \
- else /* not 0010 means 0001 */ \
- { \
- p_pic[3] = i_mask_color; \
- } \
- } \
-} \
-if( i_mask & 0x0f ) \
-{ \
- if( i_mask & 0x0c ) /* one from 1100 */ \
- { \
- if( i_mask & 0x08 ) /* 1000 */ \
- { \
- p_pic[4] = i_mask_color; \
- if( i_mask & 0x04 ) /* 0100 */ \
- { \
- p_pic[5] = i_mask_color; \
- } \
- } \
- else /* not 1000 means 0100 */ \
- { \
- p_pic[5] = i_mask_color; \
- } \
- if( i_mask & 0x03 ) /* one from 0011 */ \
- { \
- if( i_mask & 0x02 ) /* 0010 */ \
- { \
- p_pic[6] = i_mask_color; \
- if( i_mask & 0x01 ) /* 0001 */ \
- { \
- p_pic[7] = i_mask_color; \
- } \
- } \
- else /* not 0010 means 0001 */ \
- { \
- p_pic[7] = i_mask_color; \
- } \
- } \
- } \
- else /* not 1100 means 0011 */ \
- { \
- if( i_mask & 0x02 ) /* 0010 */ \
- { \
- p_pic[6] = i_mask_color; \
- if( i_mask & 0x01 ) /* 0001 */ \
- { \
- p_pic[7] = i_mask_color; \
- } \
- } \
- else /* not 0010 means 0001 */ \
- { \
- p_pic[7] = i_mask_color; \
- } \
- } \
-}
-
-/*****************************************************************************
- * Local prototypes
- *****************************************************************************/
-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 );
-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,
- 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
- *****************************************************************************
- * This function will try to open a .psf font and load it. It will return
- * NULL on error.
- *****************************************************************************/
-vout_font_t *vout_LoadFont( const char *psz_name )
-{
- static char * path[] = { "share", DATA_PATH, NULL, NULL };
-
- char ** ppsz_path = path;
- char * psz_file;
-#if defined( SYS_BEOS ) || defined( SYS_DARWIN )
- char * psz_vlcpath = system_GetProgramPath();
- int i_vlclen = strlen( psz_vlcpath );
-#endif
- int i_char, i_line; /* character and line indexes */
- int i_file = -1; /* source file */
- byte_t pi_buffer[2]; /* file buffer */
- vout_font_t * p_font; /* the font itself */
-
- for( ; *ppsz_path != NULL ; ppsz_path++ )
- {
-#if defined( SYS_BEOS ) || defined( SYS_DARWIN )
- /* Under BeOS, we need to add beos_GetProgramPath() to access
- * files under the current directory */
- if( strncmp( *ppsz_path, "/", 1 ) )
- {
- psz_file = malloc( strlen( psz_name ) + strlen( *ppsz_path )
- + i_vlclen + 3 );
- if( psz_file == NULL )
- {
- continue;
- }
- sprintf( psz_file, "%s/%s/%s", psz_vlcpath, *ppsz_path, psz_name );
- }
- else
-#endif
- {
- psz_file = malloc( strlen( psz_name ) + strlen( *ppsz_path ) + 2 );
- if( psz_file == NULL )
- {
- continue;
- }
- sprintf( psz_file, "%s/%s", *ppsz_path, psz_name );
- }
-
- /* Open file */
- i_file = open( psz_file, O_RDONLY );
- free( psz_file );
-
- if( i_file != -1 )
- {
- break;
- }
- }
-
- if( i_file == -1 )