freetype-commit
[Top][All Lists]
Advanced

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

[freetype2] master 050a32076: [raster] Keep only bottom y-turns.


From: Werner Lemberg
Subject: [freetype2] master 050a32076: [raster] Keep only bottom y-turns.
Date: Wed, 15 Nov 2023 23:44:27 -0500 (EST)

branch: master
commit 050a3207641359e4b76994bd671a2f5e567bb74a
Author: Alexei Podtelezhnikov <apodtele@gmail.com>
Commit: Alexei Podtelezhnikov <apodtele@gmail.com>

    [raster] Keep only bottom y-turns.
    
    This results in noticeable performance improvement.
    
    * src/raster/ftraster.c (Insert_Y_Turns): All bottom y-turns are still
    sorted and stored; only the maximum top y-turn is recorded now. The
    function is renamed.
    (End_Profile): Updated accordingly.
    (Convert_Glyph): Reserve space for the top value.
---
 src/raster/ftraster.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/src/raster/ftraster.c b/src/raster/ftraster.c
index ea87ab105..7f1077ca3 100644
--- a/src/raster/ftraster.c
+++ b/src/raster/ftraster.c
@@ -116,8 +116,8 @@
    *   generated until the end of the outline.
    *
    *   Note that, for all generated profiles, the function End_Profile()
-   *   is used to record their bottom-most scanline as well as the
-   *   scanline above its upmost boundary.  These positions are called
+   *   is used to record all their bottom-most scanlines as well as the
+   *   scanline above their upmost boundary.  These positions are called
    *   `y-turns' because they (sort of) correspond to local extrema.
    *   They are stored in a sorted list built from the top of the render
    *   pool as a downwards stack:
@@ -579,12 +579,17 @@
    *   SUCCESS on success.  FAILURE in case of overflow.
    */
   static Bool
-  Insert_Y_Turn( RAS_ARGS Int  y )
+  Insert_Y_Turns( RAS_ARGS Int  y,
+                           Int  top )
   {
     Int    n       = ras.numTurns;
     PLong  y_turns = ras.maxBuff;
 
 
+    /* update top value */
+    if ( n == 0 || top > y_turns[n] )
+      y_turns[n] = top;
+
     /* look for first y value that is <= */
     while ( n-- && y < y_turns[n] )
       ;
@@ -751,8 +756,7 @@
         p->X      = p->x[h - 1];
       }
 
-      if ( Insert_Y_Turn( RAS_VARS bottom ) ||
-           Insert_Y_Turn( RAS_VARS top )    )
+      if ( Insert_Y_Turns( RAS_VARS bottom, top ) )
         return FAILURE;
 
       if ( !ras.gProfile )
@@ -1820,7 +1824,7 @@
     ras.cProfile = NULL;
 
     ras.top      = ras.buff;
-    ras.maxBuff  = ras.sizeBuff;
+    ras.maxBuff  = ras.sizeBuff - 1;  /* top reserve */
 
     ras.numTurns  = 0;
     ras.num_Profs = 0;



reply via email to

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