< prev index next >
src/java.desktop/share/native/libfreetype/src/base/ftlcdfil.c
Print this page
*** 75,99 ****
/* FIR filter used by the default and light filters */
FT_BASE_DEF( void )
ft_lcd_filter_fir( FT_Bitmap* bitmap,
- FT_Render_Mode mode,
FT_LcdFiveTapFilter weights )
{
FT_UInt width = (FT_UInt)bitmap->width;
FT_UInt height = (FT_UInt)bitmap->rows;
FT_Int pitch = bitmap->pitch;
FT_Byte* origin = bitmap->buffer;
/* take care of bitmap flow */
if ( pitch > 0 && height > 0 )
origin += pitch * (FT_Int)( height - 1 );
/* horizontal in-place FIR filter */
! if ( mode == FT_RENDER_MODE_LCD && width >= 2 )
{
FT_Byte* line = origin;
/* `fir' must be at least 32 bit wide, since the sum of */
--- 75,99 ----
/* FIR filter used by the default and light filters */
FT_BASE_DEF( void )
ft_lcd_filter_fir( FT_Bitmap* bitmap,
FT_LcdFiveTapFilter weights )
{
FT_UInt width = (FT_UInt)bitmap->width;
FT_UInt height = (FT_UInt)bitmap->rows;
FT_Int pitch = bitmap->pitch;
FT_Byte* origin = bitmap->buffer;
+ FT_Byte mode = bitmap->pixel_mode;
/* take care of bitmap flow */
if ( pitch > 0 && height > 0 )
origin += pitch * (FT_Int)( height - 1 );
/* horizontal in-place FIR filter */
! if ( mode == FT_PIXEL_MODE_LCD && width >= 2 )
{
FT_Byte* line = origin;
/* `fir' must be at least 32 bit wide, since the sum of */
*** 132,142 ****
line[xx - 1] = FT_SHIFTCLAMP( fir[2] );
}
}
/* vertical in-place FIR filter */
! else if ( mode == FT_RENDER_MODE_LCD_V && height >= 2 )
{
FT_Byte* column = origin;
for ( ; width > 0; width--, column++ )
--- 132,142 ----
line[xx - 1] = FT_SHIFTCLAMP( fir[2] );
}
}
/* vertical in-place FIR filter */
! else if ( mode == FT_PIXEL_MODE_LCD_V && height >= 2 )
{
FT_Byte* column = origin;
for ( ; width > 0; width--, column++ )
*** 181,197 ****
#ifdef USE_LEGACY
/* intra-pixel filter used by the legacy filter */
static void
_ft_lcd_filter_legacy( FT_Bitmap* bitmap,
- FT_Render_Mode mode,
FT_Byte* weights )
{
FT_UInt width = (FT_UInt)bitmap->width;
FT_UInt height = (FT_UInt)bitmap->rows;
FT_Int pitch = bitmap->pitch;
FT_Byte* origin = bitmap->buffer;
static const unsigned int filters[3][3] =
{
{ 65538 * 9/13, 65538 * 1/6, 65538 * 1/13 },
{ 65538 * 3/13, 65538 * 4/6, 65538 * 3/13 },
--- 181,197 ----
#ifdef USE_LEGACY
/* intra-pixel filter used by the legacy filter */
static void
_ft_lcd_filter_legacy( FT_Bitmap* bitmap,
FT_Byte* weights )
{
FT_UInt width = (FT_UInt)bitmap->width;
FT_UInt height = (FT_UInt)bitmap->rows;
FT_Int pitch = bitmap->pitch;
FT_Byte* origin = bitmap->buffer;
+ FT_Byte mode = bitmap->pixel_mode;
static const unsigned int filters[3][3] =
{
{ 65538 * 9/13, 65538 * 1/6, 65538 * 1/13 },
{ 65538 * 3/13, 65538 * 4/6, 65538 * 3/13 },
*** 204,214 ****
/* take care of bitmap flow */
if ( pitch > 0 && height > 0 )
origin += pitch * (FT_Int)( height - 1 );
/* horizontal in-place intra-pixel filter */
! if ( mode == FT_RENDER_MODE_LCD && width >= 3 )
{
FT_Byte* line = origin;
for ( ; height > 0; height--, line -= pitch )
--- 204,214 ----
/* take care of bitmap flow */
if ( pitch > 0 && height > 0 )
origin += pitch * (FT_Int)( height - 1 );
/* horizontal in-place intra-pixel filter */
! if ( mode == FT_PIXEL_MODE_LCD && width >= 3 )
{
FT_Byte* line = origin;
for ( ; height > 0; height--, line -= pitch )
*** 241,251 ****
line[xx + 1] = (FT_Byte)( g / 65536 );
line[xx + 2] = (FT_Byte)( b / 65536 );
}
}
}
! else if ( mode == FT_RENDER_MODE_LCD_V && height >= 3 )
{
FT_Byte* column = origin;
for ( ; width > 0; width--, column++ )
--- 241,251 ----
line[xx + 1] = (FT_Byte)( g / 65536 );
line[xx + 2] = (FT_Byte)( b / 65536 );
}
}
}
! else if ( mode == FT_PIXEL_MODE_LCD_V && height >= 3 )
{
FT_Byte* column = origin;
for ( ; width > 0; width--, column++ )
< prev index next >