Remove unused LCD code

This commit is contained in:
UnknownShadow200 2020-03-21 17:14:36 +11:00
parent 1d6d79a864
commit 001e399ee2
11 changed files with 12 additions and 282 deletions

View File

@ -179,8 +179,6 @@
new_pitch = ( width + xpixels + 1 ) >> 1;
break;
case FT_PIXEL_MODE_GRAY:
case FT_PIXEL_MODE_LCD:
case FT_PIXEL_MODE_LCD_V:
bpp = 8;
new_pitch = width + xpixels;
break;
@ -349,14 +347,6 @@
xstr = 8;
break;
case FT_PIXEL_MODE_LCD:
xstr *= 3;
break;
case FT_PIXEL_MODE_LCD_V:
ystr *= 3;
break;
case FT_PIXEL_MODE_BGRA:
/* We don't embolden color glyphs. */
return FT_Err_Ok;
@ -529,8 +519,6 @@
case FT_PIXEL_MODE_GRAY:
case FT_PIXEL_MODE_GRAY2:
case FT_PIXEL_MODE_GRAY4:
case FT_PIXEL_MODE_LCD:
case FT_PIXEL_MODE_LCD_V:
case FT_PIXEL_MODE_BGRA:
{
FT_Int pad, old_target_pitch, target_pitch;
@ -640,8 +628,6 @@
case FT_PIXEL_MODE_GRAY:
case FT_PIXEL_MODE_LCD:
case FT_PIXEL_MODE_LCD_V:
{
FT_UInt width = source->width;
FT_UInt i;

View File

@ -2548,11 +2548,6 @@
/* compute flags depending on render mode, etc. */
mode = metrics->root.scaler.render_mode;
#if 0 /* #ifdef AF_CONFIG_OPTION_USE_WARPER */
if ( mode == FT_RENDER_MODE_LCD || mode == FT_RENDER_MODE_LCD_V )
metrics->root.scaler.render_mode = mode = FT_RENDER_MODE_NORMAL;
#endif
scaler_flags = hints->scaler_flags;
other_flags = 0;
@ -2560,20 +2555,20 @@
* We snap the width of vertical stems for the monochrome and
* horizontal LCD rendering targets only.
*/
if ( mode == FT_RENDER_MODE_MONO || mode == FT_RENDER_MODE_LCD )
if ( mode == FT_RENDER_MODE_MONO )
other_flags |= AF_LATIN_HINTS_HORZ_SNAP;
/*
* We snap the width of horizontal stems for the monochrome and
* vertical LCD rendering targets only.
*/
if ( mode == FT_RENDER_MODE_MONO || mode == FT_RENDER_MODE_LCD_V )
if ( mode == FT_RENDER_MODE_MONO )
other_flags |= AF_LATIN_HINTS_VERT_SNAP;
/*
* We adjust stems to full pixels unless in `light' or `lcd' mode.
*/
if ( mode != FT_RENDER_MODE_LIGHT && mode != FT_RENDER_MODE_LCD )
if ( mode != FT_RENDER_MODE_LIGHT )
other_flags |= AF_LATIN_HINTS_STEM_ADJUST;
if ( mode == FT_RENDER_MODE_MONO )
@ -2586,7 +2581,7 @@
* However, if warping is enabled (which only works in `light' hinting
* mode), advance widths get adjusted, too.
*/
if ( mode == FT_RENDER_MODE_LIGHT || mode == FT_RENDER_MODE_LCD ||
if ( mode == FT_RENDER_MODE_LIGHT ||
( face->style_flags & FT_STYLE_FLAG_ITALIC ) != 0 )
scaler_flags |= AF_SCALER_FLAG_NO_HORIZONTAL;

View File

@ -2936,8 +2936,6 @@ FT_BEGIN_HEADER
#define FT_LOAD_TARGET_NORMAL FT_LOAD_TARGET_( FT_RENDER_MODE_NORMAL )
#define FT_LOAD_TARGET_LIGHT FT_LOAD_TARGET_( FT_RENDER_MODE_LIGHT )
#define FT_LOAD_TARGET_MONO FT_LOAD_TARGET_( FT_RENDER_MODE_MONO )
#define FT_LOAD_TARGET_LCD FT_LOAD_TARGET_( FT_RENDER_MODE_LCD )
#define FT_LOAD_TARGET_LCD_V FT_LOAD_TARGET_( FT_RENDER_MODE_LCD_V )
/**************************************************************************
@ -3019,18 +3017,6 @@ FT_BEGIN_HEADER
/* This mode corresponds to 1-bit bitmaps (with 2~levels of */
/* opacity). */
/* */
/* FT_RENDER_MODE_LCD :: */
/* This mode corresponds to horizontal RGB and BGR subpixel */
/* displays like LCD screens. It produces 8-bit bitmaps that are */
/* 3~times the width of the original glyph outline in pixels, and */
/* which use the @FT_PIXEL_MODE_LCD mode. */
/* */
/* FT_RENDER_MODE_LCD_V :: */
/* This mode corresponds to vertical RGB and BGR subpixel displays */
/* (like PDA screens, rotated LCD displays, etc.). It produces */
/* 8-bit bitmaps that are 3~times the height of the original */
/* glyph outline in pixels and use the @FT_PIXEL_MODE_LCD_V mode. */
/* */
/* <Note> */
/* The selected render mode only affects vector glyphs of a font. */
/* Embedded bitmaps often have a different pixel mode like */

View File

@ -156,18 +156,6 @@ FT_BEGIN_HEADER
/* bitmaps in font files according to the OpenType specification. */
/* We haven't found a single font using this format, however. */
/* */
/* FT_PIXEL_MODE_LCD :: */
/* An 8-bit bitmap, representing RGB or BGR decimated glyph images */
/* used for display on LCD displays; the bitmap is three times */
/* wider than the original glyph image. See also */
/* @FT_RENDER_MODE_LCD. */
/* */
/* FT_PIXEL_MODE_LCD_V :: */
/* An 8-bit bitmap, representing RGB or BGR decimated glyph images */
/* used for display on rotated LCD displays; the bitmap is three */
/* times taller than the original glyph image. See also */
/* @FT_RENDER_MODE_LCD_V. */
/* */
/* FT_PIXEL_MODE_BGRA :: */
/* [Since 2.5] An image with four 8-bit channels per pixel, */
/* representing a color image (such as emoticons) with alpha */
@ -193,15 +181,6 @@ FT_BEGIN_HEADER
} FT_Pixel_Mode;
/* these constants are deprecated; use the corresponding `FT_Pixel_Mode' */
/* values instead. */
#define ft_pixel_mode_none FT_PIXEL_MODE_NONE
#define ft_pixel_mode_mono FT_PIXEL_MODE_MONO
#define ft_pixel_mode_grays FT_PIXEL_MODE_GRAY
#define ft_pixel_mode_pal2 FT_PIXEL_MODE_GRAY2
#define ft_pixel_mode_pal4 FT_PIXEL_MODE_GRAY4
/*************************************************************************/
/* */
/* <Struct> */

View File

@ -21,7 +21,5 @@ FT_USE_MODULE( FT_Module_Class, pshinter_module_class )
FT_USE_MODULE( FT_Renderer_Class, ft_raster1_renderer_class )
FT_USE_MODULE( FT_Module_Class, sfnt_module_class )
FT_USE_MODULE( FT_Renderer_Class, ft_smooth_renderer_class )
FT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcd_renderer_class )
FT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcdv_renderer_class )
/* EOF */

View File

@ -343,19 +343,10 @@
#endif
break;
case FT_RENDER_MODE_LCD:
pixel_mode = FT_PIXEL_MODE_LCD;
goto Round;
case FT_RENDER_MODE_LCD_V:
pixel_mode = FT_PIXEL_MODE_LCD_V;
goto Round;
case FT_RENDER_MODE_NORMAL:
case FT_RENDER_MODE_LIGHT:
default:
pixel_mode = FT_PIXEL_MODE_GRAY;
Round:
cbox.xMin = FT_PIX_FLOOR( cbox.xMin );
cbox.yMin = FT_PIX_FLOOR( cbox.yMin );
cbox.xMax = FT_PIX_CEIL_LONG( cbox.xMax );
@ -377,15 +368,6 @@
pitch = ( ( width + 15 ) >> 4 ) << 1;
break;
case FT_PIXEL_MODE_LCD:
width *= 3;
pitch = FT_PAD_CEIL( width, 4 );
break;
case FT_PIXEL_MODE_LCD_V:
height *= 3;
/* fall through */
case FT_PIXEL_MODE_GRAY:
default:
pitch = width;

View File

@ -674,9 +674,7 @@
params.target = abitmap;
params.flags = 0;
if ( abitmap->pixel_mode == FT_PIXEL_MODE_GRAY ||
abitmap->pixel_mode == FT_PIXEL_MODE_LCD ||
abitmap->pixel_mode == FT_PIXEL_MODE_LCD_V )
if ( abitmap->pixel_mode == FT_PIXEL_MODE_GRAY )
params.flags |= FT_RASTER_FLAG_AA;
return FT_Outline_Render( library, outline, &params );

View File

@ -102,8 +102,6 @@
FT_Memory memory = render->root.memory;
FT_Pos x_shift = 0;
FT_Pos y_shift = 0;
FT_Int hmul = ( mode == FT_RENDER_MODE_LCD );
FT_Int vmul = ( mode == FT_RENDER_MODE_LCD_V );
FT_Raster_Params params;
@ -139,10 +137,7 @@
x_shift = 64 * -slot->bitmap_left;
y_shift = 64 * -slot->bitmap_top;
if ( bitmap->pixel_mode == FT_PIXEL_MODE_LCD_V )
y_shift += 64 * (FT_Int)bitmap->rows / 3;
else
y_shift += 64 * (FT_Int)bitmap->rows;
y_shift += 64 * (FT_Int)bitmap->rows;
if ( origin )
{
@ -159,105 +154,8 @@
params.source = outline;
params.flags = FT_RASTER_FLAG_AA;
#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
#else /* !FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
if ( hmul ) /* lcd */
{
FT_Byte* line;
FT_Byte* temp = NULL;
FT_UInt i, j;
unsigned int height = bitmap->rows;
unsigned int width = bitmap->width;
int pitch = bitmap->pitch;
/* Render 3 separate monochrome bitmaps, shifting the outline */
/* by 1/3 pixel. */
width /= 3;
bitmap->buffer += width;
error = render->raster_render( render->raster, &params );
if ( error )
goto Exit;
FT_Outline_Translate( outline, -21, 0 );
x_shift -= 21;
bitmap->buffer += width;
error = render->raster_render( render->raster, &params );
if ( error )
goto Exit;
FT_Outline_Translate( outline, 42, 0 );
x_shift += 42;
bitmap->buffer -= 2 * width;
error = render->raster_render( render->raster, &params );
if ( error )
goto Exit;
/* XXX: Rearrange the bytes according to FT_PIXEL_MODE_LCD. */
/* XXX: It is more efficient to render every third byte above. */
if ( FT_ALLOC( temp, (FT_ULong)pitch ) )
goto Exit;
for ( i = 0; i < height; i++ )
{
line = bitmap->buffer + i * (FT_ULong)pitch;
for ( j = 0; j < width; j++ )
{
temp[3 * j ] = line[j];
temp[3 * j + 1] = line[j + width];
temp[3 * j + 2] = line[j + width + width];
}
FT_MEM_COPY( line, temp, pitch );
}
FT_FREE( temp );
}
else if ( vmul ) /* lcd_v */
{
int pitch = bitmap->pitch;
/* Render 3 separate monochrome bitmaps, shifting the outline */
/* by 1/3 pixel. Triple the pitch to render on each third row. */
bitmap->pitch *= 3;
bitmap->rows /= 3;
bitmap->buffer += pitch;
error = render->raster_render( render->raster, &params );
if ( error )
goto Exit;
FT_Outline_Translate( outline, 0, 21 );
y_shift += 21;
bitmap->buffer += pitch;
error = render->raster_render( render->raster, &params );
if ( error )
goto Exit;
FT_Outline_Translate( outline, 0, -42 );
y_shift -= 42;
bitmap->buffer -= 2 * pitch;
error = render->raster_render( render->raster, &params );
if ( error )
goto Exit;
bitmap->pitch /= 3;
bitmap->rows *= 3;
}
else /* grayscale */
error = render->raster_render( render->raster, &params );
#endif /* !FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
/* grayscale */
error = render->raster_render( render->raster, &params );
Exit:
if ( !error )
@ -293,30 +191,6 @@
}
/* convert a slot's glyph image into a horizontal LCD bitmap */
static FT_Error
ft_smooth_render_lcd( FT_Renderer render,
FT_GlyphSlot slot,
FT_Render_Mode mode,
const FT_Vector* origin )
{
return ft_smooth_render_generic( render, slot, mode, origin,
FT_RENDER_MODE_LCD );
}
/* convert a slot's glyph image into a vertical LCD bitmap */
static FT_Error
ft_smooth_render_lcd_v( FT_Renderer render,
FT_GlyphSlot slot,
FT_Render_Mode mode,
const FT_Vector* origin )
{
return ft_smooth_render_generic( render, slot, mode, origin,
FT_RENDER_MODE_LCD_V );
}
FT_DEFINE_RENDERER(
ft_smooth_renderer_class,
@ -344,58 +218,4 @@
)
FT_DEFINE_RENDERER(
ft_smooth_lcd_renderer_class,
FT_MODULE_RENDERER,
sizeof ( FT_RendererRec ),
"smooth-lcd",
0x10000L,
0x20000L,
NULL, /* module specific interface */
(FT_Module_Constructor)ft_smooth_init, /* module_init */
(FT_Module_Destructor) NULL, /* module_done */
(FT_Module_Requester) NULL, /* get_interface */
FT_GLYPH_FORMAT_OUTLINE,
(FT_Renderer_RenderFunc) ft_smooth_render_lcd, /* render_glyph */
(FT_Renderer_TransformFunc)ft_smooth_transform, /* transform_glyph */
(FT_Renderer_GetCBoxFunc) ft_smooth_get_cbox, /* get_glyph_cbox */
(FT_Renderer_SetModeFunc) ft_smooth_set_mode, /* set_mode */
(FT_Raster_Funcs*)&ft_grays_raster /* raster_class */
)
FT_DEFINE_RENDERER(
ft_smooth_lcdv_renderer_class,
FT_MODULE_RENDERER,
sizeof ( FT_RendererRec ),
"smooth-lcdv",
0x10000L,
0x20000L,
NULL, /* module specific interface */
(FT_Module_Constructor)ft_smooth_init, /* module_init */
(FT_Module_Destructor) NULL, /* module_done */
(FT_Module_Requester) NULL, /* get_interface */
FT_GLYPH_FORMAT_OUTLINE,
(FT_Renderer_RenderFunc) ft_smooth_render_lcd_v, /* render_glyph */
(FT_Renderer_TransformFunc)ft_smooth_transform, /* transform_glyph */
(FT_Renderer_GetCBoxFunc) ft_smooth_get_cbox, /* get_glyph_cbox */
(FT_Renderer_SetModeFunc) ft_smooth_set_mode, /* set_mode */
(FT_Raster_Funcs*)&ft_grays_raster /* raster_class */
)
/* END */

View File

@ -29,10 +29,6 @@ FT_BEGIN_HEADER
FT_DECLARE_RENDERER( ft_smooth_renderer_class )
FT_DECLARE_RENDERER( ft_smooth_lcd_renderer_class )
FT_DECLARE_RENDERER( ft_smooth_lcdv_renderer_class )
FT_END_HEADER

View File

@ -2143,11 +2143,9 @@
glyph->do_horz_hints = 1;
glyph->do_vert_hints = 1;
glyph->do_horz_snapping = FT_BOOL( hint_mode == FT_RENDER_MODE_MONO ||
hint_mode == FT_RENDER_MODE_LCD );
glyph->do_horz_snapping = FT_BOOL( hint_mode == FT_RENDER_MODE_MONO );
glyph->do_vert_snapping = FT_BOOL( hint_mode == FT_RENDER_MODE_MONO ||
hint_mode == FT_RENDER_MODE_LCD_V );
glyph->do_vert_snapping = FT_BOOL( hint_mode == FT_RENDER_MODE_MONO );
glyph->do_stem_adjust = FT_BOOL( hint_mode != FT_RENDER_MODE_LIGHT );

View File

@ -2424,16 +2424,8 @@
subpixel_hinting_lean =
FT_BOOL( FT_LOAD_TARGET_MODE( load_flags ) !=
FT_RENDER_MODE_MONO );
grayscale_cleartype =
FT_BOOL( subpixel_hinting_lean &&
!( ( load_flags &
FT_LOAD_TARGET_LCD ) ||
( load_flags &
FT_LOAD_TARGET_LCD_V ) ) );
exec->vertical_lcd_lean =
FT_BOOL( subpixel_hinting_lean &&
( load_flags &
FT_LOAD_TARGET_LCD_V ) );
grayscale_cleartype = FT_BOOL( subpixel_hinting_lean );
exec->vertical_lcd_lean = FALSE;
}
else
{