freetype-commit
[Top][All Lists]
Advanced

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

[freetype2] master 53ae7a5: [smooth] Reduce divisions in the line render


From: Alexei Podtelezhnikov
Subject: [freetype2] master 53ae7a5: [smooth] Reduce divisions in the line renderer.
Date: Fri, 23 Sep 2016 03:02:33 +0000 (UTC)

branch: master
commit 53ae7a542dd7c7b36168cdddb120ef3e0ab97f43
Author: Alexei Podtelezhnikov <address@hidden>
Commit: Alexei Podtelezhnikov <address@hidden>

    [smooth] Reduce divisions in the line renderer.
    
    We don't need some divisions if a line segments stays within a single
    row or a single column of pixels.
    
    * src/smooth/ftgrays.c (gray_render_line) [FT_LONG64]: Make divisions
    conditional.
---
 ChangeLog            |   10 ++++++++++
 src/smooth/ftgrays.c |    9 +++++----
 2 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index e79dce8..e698225 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2016-09-22  Alexei Podtelezhnikov  <address@hidden>
+
+       [smooth] Reduce divisions in the line renderer.
+
+       We don't need some divisions if a line segments stays within a single
+       row or a single column of pixels.
+
+       * src/smooth/ftgrays.c (gray_render_line) [FT_LONG64]: Make divisions
+       conditional.
+
 2016-09-15  Alexei Podtelezhnikov  <address@hidden>
 
        * src/smooth/ftgrays.c (gray_sweep): Remove check for empty table.
diff --git a/src/smooth/ftgrays.c b/src/smooth/ftgrays.c
index 75108da..7558312 100644
--- a/src/smooth/ftgrays.c
+++ b/src/smooth/ftgrays.c
@@ -371,8 +371,9 @@ typedef ptrdiff_t  FT_PtrDist;
 
   /* These macros speed up repetitive divisions by replacing them */
   /* with multiplications and right shifts.                       */
-#define FT_UDIVPREP( b )                                       \
-  long  b ## _r = (long)( FT_ULONG_MAX >> PIXEL_BITS ) / ( b )
+#define FT_UDIVPREP( c, b )                                        \
+  long  b ## _r = c ? (long)( FT_ULONG_MAX >> PIXEL_BITS ) / ( b ) \
+                    : 0
 #define FT_UDIV( a, b )                                        \
   ( ( (unsigned long)( a ) * (unsigned long)( b ## _r ) ) >>   \
     ( sizeof( long ) * FT_CHAR_BIT - PIXEL_BITS ) )
@@ -890,8 +891,8 @@ typedef ptrdiff_t  FT_PtrDist;
     else                                  /* any other line */
     {
       TPos  prod = dx * fy1 - dy * fx1;
-      FT_UDIVPREP( dx );
-      FT_UDIVPREP( dy );
+      FT_UDIVPREP( ex1 != ex2, dx );
+      FT_UDIVPREP( ey1 != ey2, dy );
 
 
       /* The fundamental value `prod' determines which side and the  */



reply via email to

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