[PATCH 4/4] Simplify glyph advance handling

Matthias Dahl ml_openjdk-lists at binary-island.eu
Wed Dec 28 15:32:02 UTC 2016


From: Matthias Dahl <matthias.dahl at binary-island.eu>
Date: Tue, 27 Dec 2016 19:39:04 +0100
Subject: [PATCH 4/4] Simplify glyph advance handling

Reduce the branches and always round and convert the advance, no matter
if its zero or not since it is guaranteed that 0 divided by a floating
point always equals zero.
---
 src/share/native/sun/font/freetypeScaler.c | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/src/share/native/sun/font/freetypeScaler.c b/src/share/native/sun/font/freetypeScaler.c
index 3d67cce9b..0bd19df7a 100644
--- a/src/share/native/sun/font/freetypeScaler.c
+++ b/src/share/native/sun/font/freetypeScaler.c
@@ -945,18 +945,10 @@ Java_sun_font_FreetypeFontScaler_getGlyphImageNative(
         glyphInfo->advanceY =
             (float) (advh * FTFixedToFloat(context->transform.xy));
     } else {
-        if (!ftglyph->advance.y) {
-            glyphInfo->advanceX =
-                (float) FT26Dot6ToFloat(ROUND26Dot6(ftglyph->advance.x));
-            glyphInfo->advanceY = 0;
-        } else if (!ftglyph->advance.x) {
-            glyphInfo->advanceX = 0;
-            glyphInfo->advanceY =
-                (float) -FT26Dot6ToFloat(ROUND26Dot6(ftglyph->advance.y));
-        } else {
-            glyphInfo->advanceX = FT26Dot6ToFloat(ftglyph->advance.x);
-            glyphInfo->advanceY = FT26Dot6ToFloat(-ftglyph->advance.y);
-        }
+        glyphInfo->advanceX =
+            (float) FT26Dot6ToFloat(ROUND26Dot6(ftglyph->advance.x));
+        glyphInfo->advanceY =
+            (float) -FT26Dot6ToFloat(ROUND26Dot6(ftglyph->advance.y));
     }
 
     if (imageSize == 0) {
-- 
2.11.0



More information about the distro-pkg-dev mailing list