freetype-commit
[Top][All Lists]
Advanced

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

[freetype2] master 046c4fc7b 1/3: [raster] Instantly remove profiles fro


From: Werner Lemberg
Subject: [freetype2] master 046c4fc7b 1/3: [raster] Instantly remove profiles from linked lists.
Date: Sat, 4 Nov 2023 00:06:27 -0400 (EDT)

branch: master
commit 046c4fc7beacdb5290bdb7a1faedc8a43f325187
Author: Alexei Podtelezhnikov <apodtele@gmail.com>
Commit: Alexei Podtelezhnikov <apodtele@gmail.com>

    [raster] Instantly remove profiles from linked lists.
    
    * src/raster/ftraster.c (DelOld): Remove loopy function.
    (Draw_Sweep): Implement instant profile removal.
---
 src/raster/ftraster.c | 70 ++++++++++++++-------------------------------------
 1 file changed, 19 insertions(+), 51 deletions(-)

diff --git a/src/raster/ftraster.c b/src/raster/ftraster.c
index 1182ff4b8..5538c0c07 100644
--- a/src/raster/ftraster.c
+++ b/src/raster/ftraster.c
@@ -2017,39 +2017,6 @@
   }
 
 
-  /**************************************************************************
-   *
-   * DelOld
-   *
-   *   Removes an old profile from a linked list.
-   */
-  static void
-  DelOld( PProfileList    list,
-          const PProfile  profile )
-  {
-    PProfile  *old, current;
-
-
-    old     = list;
-    current = *old;
-
-    while ( current )
-    {
-      if ( current == profile )
-      {
-        *old = current->link;
-        return;
-      }
-
-      old     = &current->link;
-      current = *old;
-    }
-
-    /* we should never get there, unless the profile was not part of */
-    /* the list.                                                     */
-  }
-
-
   /**************************************************************************
    *
    * Sort
@@ -2589,7 +2556,7 @@
     Int           min_Y, max_Y, dropouts;
     Int           y, y_change, y_height;
 
-    PProfile      P, Q, P_Left, P_Right;
+    PProfile      *Q, P, P_Left, P_Right;
 
     TProfileList  waiting    = ras.fProfile;
     TProfileList  draw_left  = NULL;
@@ -2625,23 +2592,22 @@
     {
       /* check waiting list for new profile activations */
 
-      P = waiting;
-
-      while ( P )
+      Q = &waiting;
+      while ( *Q )
       {
-        Q = P->link;
+        P = *Q;
         P->countL -= y_height;
         if ( P->countL == 0 )
         {
-          DelOld( &waiting, P );
+          *Q = P->link;  /* remove */
 
           if ( P->flags & Flow_Up )
             InsNew( &draw_left,  P );
           else
             InsNew( &draw_right, P );
         }
-
-        P = Q;
+        else
+          Q = &P->link;
       }
 
       /* sort the drawing lists */
@@ -2719,22 +2685,24 @@
 
       /* remove exhausted profiles */
 
-      P = draw_left;
-      while ( P )
+      Q = &draw_left;
+      while ( *Q )
       {
-        Q = P->link;
+        P = *Q;
         if ( P->height == 0 )
-          DelOld( &draw_left, P );
-        P = Q;
+          *Q = P->link;
+        else
+          Q = &P->link;
       }
 
-      P = draw_right;
-      while ( P )
+      Q = &draw_right;
+      while ( *Q )
       {
-        Q = P->link;
+        P = *Q;
         if ( P->height == 0 )
-          DelOld( &draw_right, P );
-        P = Q;
+          *Q = P->link;
+        else
+          Q = &P->link;
       }
     }
 



reply via email to

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