Commit 9154dab8155e7bb5865dd5041fc4ef7fc5450c98

Werner Lemberg 2014-11-21T08:03:51

[ftlcdfil] Obey flow direction. * src/base/ftlcdfil.c (_ft_lcd_filter_fir, _ft_lcd_filter_legacy): Handle `up' flow.

diff --git a/ChangeLog b/ChangeLog
index 73c8eb8..6dea0e3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2014-11-21  Werner Lemberg  <wl@gnu.org>
 
+	[ftlcdfil] Obey flow direction.
+
+	* src/base/ftlcdfil.c (_ft_lcd_filter_fir, _ft_lcd_filter_legacy):
+	Handle `up' flow.
+
+2014-11-21  Werner Lemberg  <wl@gnu.org>
+
 	* src/base/ftbitmap.c (FT_Bitmap_Convert): Improve.
 
 	This commit completes argument checks and adds support for different
diff --git a/src/base/ftlcdfil.c b/src/base/ftlcdfil.c
index 4aefb68..1f23c4c 100644
--- a/src/base/ftlcdfil.c
+++ b/src/base/ftlcdfil.c
@@ -46,6 +46,10 @@
       FT_Byte*  line = bitmap->buffer;
 
 
+      /* take care of bitmap flow */
+      if ( bitmap->pitch < 0 )
+        line -= bitmap->pitch * ( bitmap->rows - 1 );
+
       /* `fir' and `pix' must be at least 32 bit wide, since the sum of */
       /* the values in `weights' can exceed 0xFF                        */
 
@@ -106,6 +110,10 @@
       FT_Int    pitch  = bitmap->pitch;
 
 
+      /* take care of bitmap flow */
+      if ( bitmap->pitch < 0 )
+        column -= bitmap->pitch * ( bitmap->rows - 1 );
+
       for ( ; width > 0; width--, column++ )
       {
         FT_Byte*  col = column;
@@ -190,6 +198,10 @@
       FT_Byte*  line = bitmap->buffer;
 
 
+      /* take care of bitmap flow */
+      if ( bitmap->pitch < 0 )
+        line -= bitmap->pitch * ( bitmap->rows - 1 );
+
       for ( ; height > 0; height--, line += pitch )
       {
         FT_UInt  xx;
@@ -229,6 +241,10 @@
       FT_Byte*  column = bitmap->buffer;
 
 
+      /* take care of bitmap flow */
+      if ( bitmap->pitch < 0 )
+        column -= bitmap->pitch * ( bitmap->rows - 1 );
+
       for ( ; width > 0; width--, column++ )
       {
         FT_Byte*  col     = column;