freetype-commit
[Top][All Lists]
Advanced

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

[freetype2] master c5cd2a3: * src/truetype/ttgxvar.c (ft_var_to_normaliz


From: Werner Lemberg
Subject: [freetype2] master c5cd2a3: * src/truetype/ttgxvar.c (ft_var_to_normalized): Edge optimization.
Date: Wed, 10 Nov 2021 08:53:29 -0500 (EST)

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

    * src/truetype/ttgxvar.c (ft_var_to_normalized): Edge optimization.
---
 src/truetype/ttgxvar.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c
index 856f88f..4fda299 100644
--- a/src/truetype/ttgxvar.c
+++ b/src/truetype/ttgxvar.c
@@ -1883,19 +1883,16 @@
                     " clamping\n",
                     a->minimum / 65536.0,
                     a->maximum / 65536.0 ));
-
-        if ( coord > a->maximum )
-          coord = a->maximum;
-        else
-          coord = a->minimum;
       }
 
-      if ( coord < a->def )
-        normalized[i] = -FT_DivFix( SUB_LONG( coord, a->def ),
-                                    SUB_LONG( a->minimum, a->def ) );
-      else if ( coord > a->def )
-        normalized[i] = FT_DivFix( SUB_LONG( coord, a->def ),
+      if ( coord > a->def )
+        normalized[i] = coord >= a->maximum ?  0x10000L :
+                        FT_DivFix( SUB_LONG( coord, a->def ),
                                    SUB_LONG( a->maximum, a->def ) );
+      else if ( coord < a->def )
+        normalized[i] = coord <= a->minimum ? -0x10000L :
+                        FT_DivFix( SUB_LONG( coord, a->def ),
+                                   SUB_LONG( a->def, a->minimum ) );
       else
         normalized[i] = 0;
     }



reply via email to

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