diff options
author | Alexei Podtelezhnikov <apodtele@gmail.com> | 2019-05-02 23:06:55 -0400 |
---|---|---|
committer | Alexei Podtelezhnikov <apodtele@gmail.com> | 2019-05-02 23:06:55 -0400 |
commit | 65f9516bc7554c15d76ceb303ff110c84e61a55f (patch) | |
tree | 1f337e481d17ecd37ad5be31975cfa501be9f00a | |
parent | 65e4925af4070ef80798b8d479947aec7a0fbfc6 (diff) | |
download | freetype2-65f9516bc7554c15d76ceb303ff110c84e61a55f.tar.gz |
Tweak LCD filtering.
* src/base/ftlcdfil.c (ft_lcd_filter_fir, _ft_lcd_filter_legacy):
Choose direction from bitmap's pixel_mode.
* include/freetype/internal/ftobjs.c (FT_Bitmap_LcdFilterFunc):
Updated.
* src/smooth/ftsmooth.c (ft_smooth_render_generic): Updated.
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | include/freetype/internal/ftobjs.h | 2 | ||||
-rw-r--r-- | src/base/ftlcdfil.c | 12 | ||||
-rw-r--r-- | src/smooth/ftsmooth.c | 2 |
4 files changed, 17 insertions, 9 deletions
@@ -1,3 +1,13 @@ +2019-05-02 Alexei Podtelezhnikov <apodtele@gmail.com> + + Tweak LCD filtering. + + * src/base/ftlcdfil.c (ft_lcd_filter_fir, _ft_lcd_filter_legacy): + Choose direction from bitmap's pixel_mode. + * include/freetype/internal/ftobjs.c (FT_Bitmap_LcdFilterFunc): + Updated. + * src/smooth/ftsmooth.c (ft_smooth_render_generic): Updated. + 2019-05-02 Werner Lemberg <wl@gnu.org> * vms_make.com: Updated (#56253). diff --git a/include/freetype/internal/ftobjs.h b/include/freetype/internal/ftobjs.h index 0578dd8c3..0c1d3e5bf 100644 --- a/include/freetype/internal/ftobjs.h +++ b/include/freetype/internal/ftobjs.h @@ -278,14 +278,12 @@ FT_BEGIN_HEADER #ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING typedef void (*FT_Bitmap_LcdFilterFunc)( FT_Bitmap* bitmap, - FT_Render_Mode render_mode, FT_Byte* weights ); /* This is the default LCD filter, an in-place, 5-tap FIR filter. */ FT_BASE( void ) ft_lcd_filter_fir( FT_Bitmap* bitmap, - FT_Render_Mode mode, FT_LcdFiveTapFilter weights ); #endif /* FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ diff --git a/src/base/ftlcdfil.c b/src/base/ftlcdfil.c index 9fb49ba11..d9f4af429 100644 --- a/src/base/ftlcdfil.c +++ b/src/base/ftlcdfil.c @@ -77,13 +77,13 @@ /* 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; + FT_Byte mode = bitmap->pixel_mode; /* take care of bitmap flow */ @@ -91,7 +91,7 @@ origin += pitch * (FT_Int)( height - 1 ); /* horizontal in-place FIR filter */ - if ( mode == FT_RENDER_MODE_LCD && width >= 2 ) + if ( mode == FT_PIXEL_MODE_LCD && width >= 2 ) { FT_Byte* line = origin; @@ -134,7 +134,7 @@ } /* vertical in-place FIR filter */ - else if ( mode == FT_RENDER_MODE_LCD_V && height >= 2 ) + else if ( mode == FT_PIXEL_MODE_LCD_V && height >= 2 ) { FT_Byte* column = origin; @@ -183,13 +183,13 @@ /* 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; + FT_Byte mode = bitmap->pixel_mode; static const unsigned int filters[3][3] = { @@ -206,7 +206,7 @@ origin += pitch * (FT_Int)( height - 1 ); /* horizontal in-place intra-pixel filter */ - if ( mode == FT_RENDER_MODE_LCD && width >= 3 ) + if ( mode == FT_PIXEL_MODE_LCD && width >= 3 ) { FT_Byte* line = origin; @@ -243,7 +243,7 @@ } } } - else if ( mode == FT_RENDER_MODE_LCD_V && height >= 3 ) + else if ( mode == FT_PIXEL_MODE_LCD_V && height >= 3 ) { FT_Byte* column = origin; diff --git a/src/smooth/ftsmooth.c b/src/smooth/ftsmooth.c index c8b6bb751..cd034d2b4 100644 --- a/src/smooth/ftsmooth.c +++ b/src/smooth/ftsmooth.c @@ -243,7 +243,7 @@ } if ( lcd_filter_func ) - lcd_filter_func( bitmap, mode, lcd_weights ); + lcd_filter_func( bitmap, lcd_weights ); } #else /* !FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ |