freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[freetype2] Harmony 8901ff0 1/2: [smooth] Groundwork for Harmony.


From: Alexei Podtelezhnikov
Subject: [freetype2] Harmony 8901ff0 1/2: [smooth] Groundwork for Harmony.
Date: Thu, 9 Mar 2017 00:19:19 -0500 (EST)

branch: Harmony
commit 8901ff06d04ef507a95acf35320275e02fc946d6
Author: Alexei Podtelezhnikov <address@hidden>
Commit: Alexei Podtelezhnikov <address@hidden>

    [smooth] Groundwork for Harmony.
    
    * src/smooth/ftsmooth.c (ft_smooth_render_generic): Apply consistent
    LCD padding regardless of `FT_CONFIG_OPTION_SUBPIXEL_RENDERING'.
    
    * devel/ftoption.h: Comment out `FT_CONFIG_OPTION_SUBPIXEL_RENDERING'.
---
 ChangeLog             |  9 +++++++++
 devel/ftoption.h      |  2 +-
 src/smooth/ftsmooth.c | 53 ++++++++++++++++-----------------------------------
 3 files changed, 26 insertions(+), 38 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index b115836..4dd554d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2017-03-08  Alexei Podtelezhnikov  <address@hidden>
+
+       [smooth] Groundwork for Harmony.
+
+       * src/smooth/ftsmooth.c (ft_smooth_render_generic): Apply consistent
+       LCD padding regardless of `FT_CONFIG_OPTION_SUBPIXEL_RENDERING'.
+
+       * devel/ftoption.h: Comment out `FT_CONFIG_OPTION_SUBPIXEL_RENDERING'.
+
 2017-03-08  Werner Lemberg  <address@hidden>
 
        [sfnt] Another fix for buggy variation fonts.
diff --git a/devel/ftoption.h b/devel/ftoption.h
index b8b0a8d..ab05a7d 100644
--- a/devel/ftoption.h
+++ b/devel/ftoption.h
@@ -122,7 +122,7 @@ FT_BEGIN_HEADER
   /* This is done to allow FreeType clients to run unmodified, forcing     */
   /* them to display normal gray-level anti-aliased glyphs.                */
   /*                                                                       */
-#define FT_CONFIG_OPTION_SUBPIXEL_RENDERING
+/* #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
 
 
   /*************************************************************************/
diff --git a/src/smooth/ftsmooth.c b/src/smooth/ftsmooth.c
index 435854e..c47789c 100644
--- a/src/smooth/ftsmooth.c
+++ b/src/smooth/ftsmooth.c
@@ -107,13 +107,11 @@
     FT_Bitmap*   bitmap  = &slot->bitmap;
     FT_Memory    memory  = render->root.memory;
     FT_BBox      cbox;
+    FT_Int       lcd_extra = 2;
     FT_Pos       x_shift = 0;
     FT_Pos       y_shift = 0;
     FT_Pos       x_left, y_top;
     FT_Pos       width, height, pitch;
-#ifndef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
-    FT_Pos       height_org, width_org;
-#endif
     FT_Int       hmul    = ( mode == FT_RENDER_MODE_LCD );
     FT_Int       vmul    = ( mode == FT_RENDER_MODE_LCD_V );
 
@@ -124,7 +122,6 @@
 
 #ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
 
-    FT_Int                   lcd_extra          = 0;
     FT_LcdFiveTapFilter      lcd_weights        = { 0 };
     FT_Bool                  have_custom_weight = FALSE;
     FT_Bitmap_LcdFilterFunc  lcd_filter_func    = NULL;
@@ -215,40 +212,22 @@
     width  = (FT_ULong)( cbox.xMax - cbox.xMin ) >> 6;
     height = (FT_ULong)( cbox.yMax - cbox.yMin ) >> 6;
 
-#ifndef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
-    width_org  = width;
-    height_org = height;
-#endif
-
-    pitch = width;
     if ( hmul )
     {
-      width *= 3;
-      pitch  = FT_PAD_CEIL( width, 4 );
+      x_shift += 64 * ( lcd_extra >> 1 );
+      x_left  -= lcd_extra >> 1;
+      width    = 3 * ( width + lcd_extra );
+      pitch    = FT_PAD_CEIL( width, 4 );
     }
-
-    if ( vmul )
-      height *= 3;
-
-#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
-    if ( lcd_filter_func )
+    else if ( vmul )
     {
-      if ( hmul )
-      {
-        x_shift += 64 * ( lcd_extra >> 1 );
-        x_left  -= lcd_extra >> 1;
-        width   += 3 * lcd_extra;
-        pitch    = FT_PAD_CEIL( width, 4 );
-      }
-
-      if ( vmul )
-      {
-        y_shift += 64 * ( lcd_extra >> 1 );
-        y_top   += lcd_extra >> 1;
-        height  += 3 * lcd_extra;
-      }
+      y_shift += 64 * ( lcd_extra >> 1 );
+      y_top   += lcd_extra >> 1;
+      height   = 3 * ( height + lcd_extra );
+      pitch = width;
     }
-#endif
+    else
+      pitch = width;
 
     /*
      * XXX: on 16bit system, we return an error for huge bitmap
@@ -365,13 +344,13 @@
       FT_UInt   hh;
 
 
-      for ( hh = height_org; hh > 0; hh--, line += pitch )
+      for ( hh = height; hh > 0; hh--, line += pitch )
       {
         FT_UInt   xx;
         FT_Byte*  end = line + width;
 
 
-        for ( xx = width_org; xx > 0; xx-- )
+        for ( xx = width / 3; xx > 0; xx-- )
         {
           FT_UInt  pixel = line[xx-1];
 
@@ -387,12 +366,12 @@
     /* expand it vertically */
     if ( vmul )
     {
-      FT_Byte*  read  = bitmap->buffer + ( height - height_org ) * pitch;
+      FT_Byte*  read  = bitmap->buffer + ( height - height / 3 ) * pitch;
       FT_Byte*  write = bitmap->buffer;
       FT_UInt   hh;
 
 
-      for ( hh = height_org; hh > 0; hh-- )
+      for ( hh = height / 3; hh > 0; hh-- )
       {
         ft_memcpy( write, read, pitch );
         write += pitch;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]