shithub: freetype+ttf2subf

Download patch

ref: fb4511eb9a8fa1869e971e72b05d438fec43bb88
parent: f6370e2f0582cf8dd2850756794e9dbbc0f035bc
author: Alexei Podtelezhnikov <apodtele@gmail.com>
date: Sat Jun 26 04:49:20 EDT 2021

[raster] Make `band_top' local variable.

* src/raster/ftraster.c (black_TWorker): Move `band_top' from here...
(Render_Single_Pass): ... to here, and refactor.
(Render_Glyph): Updated.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2021-06-25  Alexei Podtelezhnikov  <apodtele@gmail.com>
 
+	[raster] Make `band_top' local variable.
+
+	* src/raster/ftraster.c (black_TWorker): Move `band_top' from here...
+	(Render_Single_Pass): ... to here, and refactor.
+	(Render_Glyph): Updated.
+
+2021-06-25  Alexei Podtelezhnikov  <apodtele@gmail.com>
+
 	[raster] Adjust sub-band bisecting limits.
 
 	We can bisect a band until it is just a single scan line.  This might
--- a/src/raster/ftraster.c
+++ b/src/raster/ftraster.c
@@ -529,7 +529,6 @@
 
     black_TBand  band_stack[16];    /* band stack used for sub-banding     */
                                     /* enough for signed short bands       */
-    Int          band_top;          /* band stack top                      */
 
   };
 
@@ -3034,12 +3033,13 @@
   Render_Single_Pass( RAS_ARGS Bool  flipped )
   {
     Short  i, j, k;
+    Int    band_top = 0;
 
 
-    while ( ras.band_top >= 0 )
+    do
     {
-      ras.maxY = (Long)ras.band_stack[ras.band_top].y_max * ras.precision;
-      ras.minY = (Long)ras.band_stack[ras.band_top].y_min * ras.precision;
+      ras.maxY = (Long)ras.band_stack[band_top].y_max * ras.precision;
+      ras.minY = (Long)ras.band_stack[band_top].y_min * ras.precision;
 
       ras.top = ras.buff;
 
@@ -3052,24 +3052,20 @@
 
         /* sub-banding */
 
-        i = ras.band_stack[ras.band_top].y_min;
-        j = ras.band_stack[ras.band_top].y_max;
+        i = ras.band_stack[band_top].y_min;
+        j = ras.band_stack[band_top].y_max;
 
         if ( i == j )
-        {
-          ras.band_top = 0;
-
           return ras.error;  /* still Raster_Overflow */
-        }
 
         k = (Short)( ( i + j ) / 2 );
 
-        ras.band_stack[ras.band_top + 1].y_min = (Short)( k + 1 );
-        ras.band_stack[ras.band_top + 1].y_max = j;
+        ras.band_stack[band_top].y_max = k;
 
-        ras.band_stack[ras.band_top].y_max = k;
+        ras.band_stack[band_top + 1].y_min = (Short)( k + 1 );
+        ras.band_stack[band_top + 1].y_max = j;
 
-        ras.band_top++;
+        band_top++;
       }
       else
       {
@@ -3076,9 +3072,9 @@
         if ( ras.fProfile )
           if ( Draw_Sweep( RAS_VAR ) )
              return ras.error;
-        ras.band_top--;
+        band_top--;
       }
-    }
+    } while ( band_top >= 0 );
 
     return Raster_Err_Ok;
   }
@@ -3128,7 +3124,6 @@
     ras.Proc_Sweep_Drop = Vertical_Sweep_Drop;
     ras.Proc_Sweep_Step = Vertical_Sweep_Step;
 
-    ras.band_top            = 0;
     ras.band_stack[0].y_min = 0;
     ras.band_stack[0].y_max = (Short)( ras.target.rows - 1 );
 
@@ -3151,7 +3146,6 @@
       ras.Proc_Sweep_Drop = Horizontal_Sweep_Drop;
       ras.Proc_Sweep_Step = Horizontal_Sweep_Step;
 
-      ras.band_top            = 0;
       ras.band_stack[0].y_min = 0;
       ras.band_stack[0].y_max = (Short)( ras.target.width - 1 );