freetype-commit
[Top][All Lists]
Advanced

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

[freetype2] master 39f2fbf80: * src/truetype/ttgxvar.c (tt_var_get_item_


From: Werner Lemberg
Subject: [freetype2] master 39f2fbf80: * src/truetype/ttgxvar.c (tt_var_get_item_delta): Minor refactoring.
Date: Mon, 20 May 2024 23:11:42 -0400 (EDT)

branch: master
commit 39f2fbf80c5ab9ad7b380080395c987f4922a038
Author: Alexei Podtelezhnikov <apodtele@gmail.com>
Commit: Alexei Podtelezhnikov <apodtele@gmail.com>

    * src/truetype/ttgxvar.c (tt_var_get_item_delta): Minor refactoring.
---
 src/truetype/ttgxvar.c | 28 +++++++++++++---------------
 1 file changed, 13 insertions(+), 15 deletions(-)

diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c
index 99a9d4db0..a2715860e 100644
--- a/src/truetype/ttgxvar.c
+++ b/src/truetype/ttgxvar.c
@@ -1074,6 +1074,9 @@
       /* inner loop steps through axes in this region */
       for ( j = 0; j < itemStore->axisCount; j++, axis++ )
       {
+        FT_Fixed  ncv = ttface->blend->normalizedcoords[j];
+
+
         /* compute the scalar contribution of this axis; */
         /* ignore invalid ranges                         */
         if ( axis->startCoord > axis->peakCoord ||
@@ -1089,28 +1092,23 @@
         else if ( axis->peakCoord == 0 )
           continue;
 
-        else if ( ttface->blend->normalizedcoords[j] == axis->peakCoord )
-          continue;
-
         /* ignore this region if coords are out of range */
-        else if ( ttface->blend->normalizedcoords[j] <= axis->startCoord ||
-                  ttface->blend->normalizedcoords[j] >= axis->endCoord   )
+        else if ( ncv <= axis->startCoord ||
+                  ncv >= axis->endCoord   )
         {
           scalar = 0;
           break;
         }
 
         /* cumulative product of all the axis scalars */
-        else if ( ttface->blend->normalizedcoords[j] < axis->peakCoord )
-          scalar =
-            FT_MulDiv( scalar,
-                       ttface->blend->normalizedcoords[j] - axis->startCoord,
-                       axis->peakCoord - axis->startCoord );
-        else
-          scalar =
-            FT_MulDiv( scalar,
-                       axis->endCoord - ttface->blend->normalizedcoords[j],
-                       axis->endCoord - axis->peakCoord );
+        else if ( ncv < axis->peakCoord )
+          scalar = FT_MulDiv( scalar,
+                              ncv - axis->startCoord,
+                              axis->peakCoord - axis->startCoord );
+        else if ( ncv > axis->peakCoord )
+          scalar = FT_MulDiv( scalar,
+                              axis->endCoord - ncv,
+                              axis->endCoord - axis->peakCoord );
 
       } /* per-axis loop */
 



reply via email to

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