shithub: freetype+ttf2subf

Download patch

ref: ad47550b80b5fa3a77d2b7d5e61193cb078e974e
parent: c38be52bf8de3b1699d74932b849bf150265819e
author: Alexei Podtelezhnikov <[email protected]>
date: Wed Sep 14 19:15:03 EDT 2016

[smooth] Another tiny speed-up.

* src/smooth/ftgrays.c (gray_find_cell): Merge into...
(gray_record_cell): ... this function.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2016-09-14  Alexei Podtelezhnikov  <[email protected]>
+
+	[smooth] Another tiny speed-up.
+
+	* src/smooth/ftgrays.c (gray_find_cell): Merge into...
+	(gray_record_cell): ... this function.
+
 2016-09-11  Alexei Podtelezhnikov  <[email protected]>
 
 	* src/smooth/ftgrays.c (gray_{find,set}_cell): Remove dubious code.
--- a/src/smooth/ftgrays.c
+++ b/src/smooth/ftgrays.c
@@ -504,8 +504,8 @@
   /*                                                                       */
   /* 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 @@
         break;
 
       if ( cell->x == x )
-        goto Exit;
+        goto Found;
 
       pcell = &cell->next;
     }
@@ -527,30 +527,21 @@
     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;
   }