Commit 652f88631932713309b6fa2cf12669699e3fc8e6

Alexei Podtelezhnikov 2020-05-11T23:30:37

[smooth] Stop using dedicated LCD modules and classes. The LCD modules were never truly independent. They mostly served as a way to disable patented LCD rendering, which is no longer necessary. The `smooth' module now handles LCD modes as well. * src/smooth/ftsmooth.c (ft_smooth_lcd_renderer_class. ft_smooth_lcdv_renderer_class): Deleted. (ft_render_smooth): Reworked from `ft_render_smooth_generic'. * src/smooth/ftsmooth.h: Remove dedicated LCD classes. * src/smooth/module.mk: Remove dedicated LCD modules. * include/freetype/config/ftmodule.h: Ditto. * builds/amiga/include/config/ftmodule.h: Ditto. * include/freetype/ftmodapi.h: Do not mention LCD modules.

diff --git a/ChangeLog b/ChangeLog
index e4ea3c5..c69edde 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2020-05-11  Alexei Podtelezhnikov  <apodtele@gmail.com>
+
+	[smooth] Stop using dedicated LCD modules and classes.
+
+	The LCD modules were never truly independent. They mostly served as
+	a way to disable patented LCD rendering, which is no longer necessary.
+	The `smooth' module now handles LCD modes as well.
+
+	* src/smooth/ftsmooth.c (ft_smooth_lcd_renderer_class.
+	ft_smooth_lcdv_renderer_class): Deleted.
+	(ft_render_smooth): Reworked from `ft_render_smooth_generic'.
+	* src/smooth/ftsmooth.h: Remove dedicated LCD classes.
+	* src/smooth/module.mk: Remove dedicated LCD modules.
+	* include/freetype/config/ftmodule.h: Ditto.
+	* builds/amiga/include/config/ftmodule.h: Ditto.
+	* include/freetype/ftmodapi.h: Do not mention LCD modules.
+
 2020-05-09  Werner Lemberg  <wl@gnu.org>
 
 	* Version 2.10.2 released.
diff --git a/builds/amiga/include/config/ftmodule.h b/builds/amiga/include/config/ftmodule.h
index 8bc1150..6035bf0 100644
--- a/builds/amiga/include/config/ftmodule.h
+++ b/builds/amiga/include/config/ftmodule.h
@@ -137,8 +137,6 @@ FT_USE_MODULE( FT_Module_Class, sfnt_module_class )
 
 #ifdef FT_USE_SMOOTH
 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 )
 #endif
 
 #ifdef FT_USE_OTV
diff --git a/include/freetype/config/ftmodule.h b/include/freetype/config/ftmodule.h
index 7c603e5..b5c4b1e 100644
--- a/include/freetype/config/ftmodule.h
+++ b/include/freetype/config/ftmodule.h
@@ -25,8 +25,6 @@ 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 )
 FT_USE_MODULE( FT_Driver_ClassRec, bdf_driver_class )
 
 /* EOF */
diff --git a/include/freetype/ftmodapi.h b/include/freetype/ftmodapi.h
index 01cb5fb..64735ff 100644
--- a/include/freetype/ftmodapi.h
+++ b/include/freetype/ftmodapi.h
@@ -65,7 +65,7 @@ FT_BEGIN_HEADER
    *     psnames
    *     raster1
    *     sfnt
-   *     smooth, smooth-lcd, smooth-lcdv
+   *     smooth
    *     truetype
    *     type1
    *     type42
diff --git a/src/smooth/ftsmooth.c b/src/smooth/ftsmooth.c
index 072045c..500e363 100644
--- a/src/smooth/ftsmooth.c
+++ b/src/smooth/ftsmooth.c
@@ -110,11 +110,10 @@
 
   /* convert a slot's glyph image into a bitmap */
   static FT_Error
-  ft_smooth_render_generic( FT_Renderer       render,
-                            FT_GlyphSlot      slot,
-                            FT_Render_Mode    mode,
-                            const FT_Vector*  origin,
-                            FT_Render_Mode    required_mode )
+  ft_smooth_render( FT_Renderer       render,
+                    FT_GlyphSlot      slot,
+                    FT_Render_Mode    mode,
+                    const FT_Vector*  origin )
   {
     FT_Error     error   = FT_Err_Ok;
     FT_Outline*  outline = &slot->outline;
@@ -136,7 +135,9 @@
     }
 
     /* check mode */
-    if ( mode != required_mode )
+    if ( mode != FT_RENDER_MODE_NORMAL &&
+         mode != FT_RENDER_MODE_LIGHT  &&
+         !hmul && !vmul )
     {
       error = FT_THROW( Cannot_Render_Glyph );
       goto Exit;
@@ -383,45 +384,6 @@
   }
 
 
-  /* convert a slot's glyph image into a bitmap */
-  static FT_Error
-  ft_smooth_render( FT_Renderer       render,
-                    FT_GlyphSlot      slot,
-                    FT_Render_Mode    mode,
-                    const FT_Vector*  origin )
-  {
-    if ( mode == FT_RENDER_MODE_LIGHT )
-      mode = FT_RENDER_MODE_NORMAL;
-
-    return ft_smooth_render_generic( render, slot, mode, origin,
-                                     FT_RENDER_MODE_NORMAL );
-  }
-
-
-  /* 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,
 
@@ -449,58 +411,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 */
diff --git a/src/smooth/ftsmooth.h b/src/smooth/ftsmooth.h
index ee5d2ff..6eeacc7 100644
--- a/src/smooth/ftsmooth.h
+++ b/src/smooth/ftsmooth.h
@@ -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
 
diff --git a/src/smooth/module.mk b/src/smooth/module.mk
index ad8b47d..9b1507f 100644
--- a/src/smooth/module.mk
+++ b/src/smooth/module.mk
@@ -18,10 +18,6 @@ FTMODULE_H_COMMANDS += SMOOTH_RENDERER
 define SMOOTH_RENDERER
 $(OPEN_DRIVER) FT_Renderer_Class, ft_smooth_renderer_class $(CLOSE_DRIVER)
 $(ECHO_DRIVER)smooth    $(ECHO_DRIVER_DESC)anti-aliased bitmap renderer$(ECHO_DRIVER_DONE)
-$(OPEN_DRIVER) FT_Renderer_Class, ft_smooth_lcd_renderer_class $(CLOSE_DRIVER)
-$(ECHO_DRIVER)smooth    $(ECHO_DRIVER_DESC)anti-aliased bitmap renderer for LCDs$(ECHO_DRIVER_DONE)
-$(OPEN_DRIVER) FT_Renderer_Class, ft_smooth_lcdv_renderer_class $(CLOSE_DRIVER)
-$(ECHO_DRIVER)smooth    $(ECHO_DRIVER_DESC)anti-aliased bitmap renderer for vertical LCDs$(ECHO_DRIVER_DONE)
 endef
 
 # EOF