[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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
diff --git a/ChangeLog b/ChangeLog
index fc6d8b0..92b2c41 100644
--- 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
diff --git a/src/raster/ftraster.c b/src/raster/ftraster.c
index b88a436..31ea655 100644
--- 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,33 +3052,29 @@
/* 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
{
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 );