Commit c162eac55c86261dafe11ba2c31c4fab93c0f4b1

Werner Lemberg 2005-05-28T21:52:37

* src/base/ftbitmap.c (FT_Bitmap_Embolden): Handle negative pitch. Handle FT_PIXEL_MODE_GRAY with num_gray != 256. Improve speed for FT_PIXEL_MODE_GRAY. (ft_bitmap_assure_buffer): Accept FT_PIXEL_MODE_LCD and FT_PIXEL_MODE_LCD_V.

diff --git a/ChangeLog b/ChangeLog
index a168039..8b1caeb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2005-05-28  Chia I Wu  <b90201047@ntu.edu.tw>
+
+	* src/base/ftbitmap.c (FT_Bitmap_Embolden): Handle negative pitch.
+	Handle FT_PIXEL_MODE_GRAY with num_gray != 256.
+	Improve speed for FT_PIXEL_MODE_GRAY.
+	(ft_bitmap_assure_buffer): Accept FT_PIXEL_MODE_LCD and
+	FT_PIXEL_MODE_LCD_V.
+
 2005-05-27  Chia I Wu  <b90201047@ntu.edu.tw>
 
 	* src/base/ftsynth.c (FT_GlyphSlot_Embolden): Initialize `error'.
diff --git a/src/base/ftbitmap.c b/src/base/ftbitmap.c
index 9de9e8f..0306188 100644
--- a/src/base/ftbitmap.c
+++ b/src/base/ftbitmap.c
@@ -115,6 +115,8 @@
     switch ( bitmap->pixel_mode )
     {
     case FT_PIXEL_MODE_MONO:
+    case FT_PIXEL_MODE_LCD:
+    case FT_PIXEL_MODE_LCD_V:
       ppb = 8;
       break;
     case FT_PIXEL_MODE_GRAY2:
@@ -210,7 +212,7 @@
     else
     {
       pitch = -pitch;
-      p = bitmap->buffer + pitch * ( bitmap->rows - ystr - 1 );
+      p = bitmap->buffer + pitch * ( bitmap->rows - 1 );
     }
 
     /* for each row */
@@ -237,16 +239,30 @@
             /* the maximum value of 8 for `xstr' comes from here */
             if ( x > 0 )
               p[x] |= p[x - 1] << ( 8 - i );
+
+#if 0
+            if ( p[x] == 0xff )
+              break;
+#endif
           }
           else if ( bitmap->pixel_mode == FT_PIXEL_MODE_GRAY )
           {
             if ( x - i >= 0 )
             {
-              if ( p[x] + p[x - i] > 0xff )
-                p[x] = 0xff;
+              if ( p[x] + p[x - i] > bitmap->num_grays )
+              {
+                p[x] = bitmap->num_grays;
+                break;
+              }
               else
+              {
                 p[x] += p[x - i];
+                if ( p[x] == bitmap->num_grays )
+                  break;
+              }
             }
+            else
+              break;
           }
         }
       }