freetype-commit
[Top][All Lists]
Advanced

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

[freetype2] master ad47550: [smooth] Another tiny speed-up.


From: Alexei Podtelezhnikov
Subject: [freetype2] master ad47550: [smooth] Another tiny speed-up.
Date: Thu, 15 Sep 2016 03:27:50 +0000 (UTC)

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

    [smooth] Another tiny speed-up.
    
    * src/smooth/ftgrays.c (gray_find_cell): Merge into...
    (gray_record_cell): ... this function.
---
 ChangeLog            |    7 +++++++
 src/smooth/ftgrays.c |   31 +++++++++++--------------------
 2 files changed, 18 insertions(+), 20 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index d442f7b..98d877d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2016-09-14  Alexei Podtelezhnikov  <address@hidden>
+
+       [smooth] Another tiny speed-up.
+
+       * src/smooth/ftgrays.c (gray_find_cell): Merge into...
+       (gray_record_cell): ... this function.
+
 2016-09-11  Alexei Podtelezhnikov  <address@hidden>
 
        * src/smooth/ftgrays.c (gray_{find,set}_cell): Remove dubious code.
diff --git a/src/smooth/ftgrays.c b/src/smooth/ftgrays.c
index 30fd4e2..ab00c1a 100644
--- a/src/smooth/ftgrays.c
+++ b/src/smooth/ftgrays.c
@@ -504,8 +504,8 @@ typedef ptrdiff_t  FT_PtrDist;
   /*                                                                       */
   /* Record the current cell in the table.                                 */
   /*                                                                       */
-  static PCell
-  gray_find_cell( RAS_ARG )
+  static void
+  gray_record_cell( RAS_ARG )
   {
     PCell  *pcell, cell;
     TCoord  x = ras.ex;
@@ -519,7 +519,7 @@ typedef ptrdiff_t  FT_PtrDist;
         break;
 
       if ( cell->x == x )
-        goto Exit;
+        goto Found;
 
       pcell = &cell->next;
     }
@@ -527,30 +527,21 @@ typedef ptrdiff_t  FT_PtrDist;
     if ( ras.num_cells >= ras.max_cells )
       ft_longjmp( ras.jump_buffer, 1 );
 
+    /* insert new cell */
     cell        = ras.cells + ras.num_cells++;
     cell->x     = x;
-    cell->area  = 0;
-    cell->cover = 0;
+    cell->area  = ras.area;
+    cell->cover = ras.cover;
 
     cell->next  = *pcell;
     *pcell      = cell;
 
-  Exit:
-    return cell;
-  }
-
+    return;
 
-  static void
-  gray_record_cell( RAS_ARG )
-  {
-    if ( ras.area | ras.cover )
-    {
-      PCell  cell = gray_find_cell( RAS_VAR );
-
-
-      cell->area  += ras.area;
-      cell->cover += ras.cover;
-    }
+  Found:
+    /* update old cell */
+    cell->area  += ras.area;
+    cell->cover += ras.cover;
   }
 
 



reply via email to

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