From 32760d33d0ebc3ba756d2bc0cce1defdafe51299 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Thu, 14 Jan 2016 23:31:08 -0500 Subject: [PATCH] [base] Empower `FT_Library_SetLcdFilterWeights'. * src/base/ftlcdfil.c (FT_Library_SetLcdFilterWeights): Enable filter in addition to setting weights. (FT_Library_SetLcdFilter): Clean out FT_FORCE_LIGHT_LCD_FILTER and FT_FORCE_LEGACY_LCD_FILTER. * include/freetype/ftlcdfil.h: Documentation update. --- ChangeLog | 10 ++++++++++ include/freetype/ftlcdfil.h | 7 ++----- src/base/ftlcdfil.c | 18 ++---------------- 3 files changed, 14 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index efa9c7563..2f83095a9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2016-01-14 Alexei Podtelezhnikov + + [base] Empower `FT_Library_SetLcdFilterWeights'. + + * src/base/ftlcdfil.c (FT_Library_SetLcdFilterWeights): Enable filter + in addition to setting weights. + (FT_Library_SetLcdFilter): Clean out FT_FORCE_LIGHT_LCD_FILTER and + FT_FORCE_LEGACY_LCD_FILTER. + * include/freetype/ftlcdfil.h: Documentation update. + 2016-01-12 Werner Lemberg Don't use macro names that start with `_[A-Z]' [3/3]. diff --git a/include/freetype/ftlcdfil.h b/include/freetype/ftlcdfil.h index 3e9f5806b..95d40230c 100644 --- a/include/freetype/ftlcdfil.h +++ b/include/freetype/ftlcdfil.h @@ -250,8 +250,8 @@ FT_BEGIN_HEADER * FT_Library_SetLcdFilterWeights * * @description: - * Use this function to override default or light filter weights - * selected by @FT_Library_SetLcdFilter. + * This function can be used to enable LCD filter with custom weights, + * instead of using presets in @FT_Library_SetLcdFilter. * * @input: * library :: @@ -271,9 +271,6 @@ FT_BEGIN_HEADER * defined in your build of the library, which should correspond to all * default builds of FreeType. * - * This function must be called after @FT_Library_SetLcdFilter to have - * any effect on default or light filter. - * * @since: * 2.4.0 */ diff --git a/src/base/ftlcdfil.c b/src/base/ftlcdfil.c index b2f35dc19..8bcbed7aa 100644 --- a/src/base/ftlcdfil.c +++ b/src/base/ftlcdfil.c @@ -296,6 +296,8 @@ return FT_THROW( Invalid_Argument ); ft_memcpy( library->lcd_weights, weights, 5 ); + library->lcd_filter_func = _ft_lcd_filter_fir; + library->lcd_extra = 2; return FT_Err_Ok; } @@ -322,25 +324,9 @@ break; case FT_LCD_FILTER_DEFAULT: -#if defined( FT_FORCE_LEGACY_LCD_FILTER ) - - library->lcd_filter_func = _ft_lcd_filter_legacy; - library->lcd_extra = 0; - -#elif defined( FT_FORCE_LIGHT_LCD_FILTER ) - - ft_memcpy( library->lcd_weights, light_filter, 5 ); - library->lcd_filter_func = _ft_lcd_filter_fir; - library->lcd_extra = 2; - -#else - ft_memcpy( library->lcd_weights, default_filter, 5 ); library->lcd_filter_func = _ft_lcd_filter_fir; library->lcd_extra = 2; - -#endif - break; case FT_LCD_FILTER_LIGHT: