freetype-commit
[Top][All Lists]
Advanced

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

[freetype2-demos] master f304c6e: [ftgrid] Avoid invalid left-shift of n


From: Werner LEMBERG
Subject: [freetype2-demos] master f304c6e: [ftgrid] Avoid invalid left-shift of negative values.
Date: Wed, 05 Aug 2015 05:05:38 +0000

branch: master
commit f304c6ebe46e8b8623c5f9cbe6e7063b43271b94
Author: Werner Lemberg <address@hidden>
Commit: Werner Lemberg <address@hidden>

    [ftgrid] Avoid invalid left-shift of negative values.
    
    * src/ftgrid.c (grid_status_draw_outline): Don't use left-shift but
    multiplication.
---
 ChangeLog    |    7 +++++++
 src/ftgrid.c |    8 ++++----
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index e84b02f..0ac9234 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2015-08-05  Werner Lemberg  <address@hidden>
+
+       [ftgrid] Avoid invalid left-shift of negative values.
+
+       * src/ftgrid.c (grid_status_draw_outline): Don't use left-shift but
+       multiplication.
+
 2015-08-04  Werner Lemberg  <address@hidden>
 
        * src/ftmulti.c (main): Fix double-free in case of invalid font.
diff --git a/src/ftgrid.c b/src/ftgrid.c
index 7c98fb2..ea8b0af 100644
--- a/src/ftgrid.c
+++ b/src/ftgrid.c
@@ -673,11 +673,11 @@
 
             /* get vectors to previous and next point and normalize them; */
             /* we use 16.16 format to improve the computation precision   */
-            in.x = ( points[prev].x - points[nn].x ) << 10;
-            in.y = ( points[prev].y - points[nn].y ) << 10;
+            in.x = ( points[prev].x - points[nn].x ) * 1024;
+            in.y = ( points[prev].y - points[nn].y ) * 1024;
 
-            out.x = ( points[next].x - points[nn].x ) << 10;
-            out.y = ( points[next].y - points[nn].y ) << 10;
+            out.x = ( points[next].x - points[nn].x ) * 1024;
+            out.y = ( points[next].y - points[nn].y ) * 1024;
 
             in_len  = FT_Vector_Length( &in );
             out_len = FT_Vector_Length( &out );



reply via email to

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