Commit ba03310b5aa6a8b752f892c32f2354aff9a73f78

Alexei Podtelezhnikov 2018-10-31T22:01:36

* src/type1/t1load.c (t1_set_mm_blend): Optimized.

diff --git a/ChangeLog b/ChangeLog
index 6379771..2b75088 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2018-10-31  Alexei Podtelezhnikov  <apodtele@gmail.com>
 
+	* src/type1/t1load.c (t1_set_mm_blend): Optimized.
+
+2018-10-31  Alexei Podtelezhnikov  <apodtele@gmail.com>
+
 	* src/truetype/ttgxvar.c (ft_var_get_item_delta): Optimized.
 
 2018-10-29  Werner Lemberg  <wl@gnu.org>
diff --git a/src/type1/t1load.c b/src/type1/t1load.c
index e358c32..01befa2 100644
--- a/src/type1/t1load.c
+++ b/src/type1/t1load.c
@@ -384,24 +384,31 @@
     for ( n = 0; n < blend->num_designs; n++ )
     {
       FT_Fixed  result = 0x10000L;  /* 1.0 fixed */
+      FT_Fixed  factor;
 
 
       for ( m = 0; m < blend->num_axis; m++ )
       {
-        FT_Fixed  factor;
-
-
-        /* get current blend axis position;                  */
         /* use a default value if we don't have a coordinate */
-        factor = m < num_coords ? coords[m] : 0x8000;
-        if ( factor < 0 )
-          factor = 0;
-        if ( factor > 0x10000L )
-          factor = 0x10000L;
+        if ( m >= num_coords )
+        {
+          result >>= 1;
+          continue;
+        }
 
+        /* get current blend axis position */
+        factor = coords[m];
         if ( ( n & ( 1 << m ) ) == 0 )
           factor = 0x10000L - factor;
 
+        if ( factor <= 0 )
+        {
+          result = 0;
+          break;
+        }
+        else if ( factor >= 0x10000L )
+          continue;
+
         result = FT_MulFix( result, factor );
       }