[raster] Clean up vertical sweep.

* src/raster/ftraster.c (black_TWorker): Replace the current line
offset with the pointer and drop the increment.
(Function_Sweep_Init): Take values as arguments instead of pointers.
(Vertical_Sweep_*, Horizontal_Sweep_Init, Draw_Sweep): Updated.
This commit is contained in:
Alexei Podtelezhnikov 2021-06-28 10:22:03 -04:00
parent fb4511eb9a
commit 3a278381ae
2 changed files with 23 additions and 19 deletions

View File

@ -1,3 +1,12 @@
2021-06-28 Alexei Podtelezhnikov <apodtele@gmail.com>
[raster] Clean up vertical sweep.
* src/raster/ftraster.c (black_TWorker): Replace the current line
offset with the pointer and drop the increment.
(Function_Sweep_Init): Take values as arguments instead of pointers.
(Vertical_Sweep_*, Horizontal_Sweep_Init, Draw_Sweep): Updated.
2021-06-25 Alexei Podtelezhnikov <apodtele@gmail.com> 2021-06-25 Alexei Podtelezhnikov <apodtele@gmail.com>
[raster] Make `band_top' local variable. [raster] Make `band_top' local variable.

View File

@ -417,8 +417,8 @@
/* prototypes used for sweep function dispatch */ /* prototypes used for sweep function dispatch */
typedef void typedef void
Function_Sweep_Init( RAS_ARGS Short* min, Function_Sweep_Init( RAS_ARGS Short min,
Short* max ); Short max );
typedef void typedef void
Function_Sweep_Span( RAS_ARGS Short y, Function_Sweep_Span( RAS_ARGS Short y,
@ -487,6 +487,7 @@
UShort bWidth; /* target bitmap width */ UShort bWidth; /* target bitmap width */
PByte bOrigin; /* target bitmap bottom-left origin */ PByte bOrigin; /* target bitmap bottom-left origin */
PByte bLine; /* target bitmap current line */
Long lastX, lastY; Long lastX, lastY;
Long minY, maxY; Long minY, maxY;
@ -508,9 +509,6 @@
FT_Bitmap target; /* description of target bit/pixmap */ FT_Bitmap target; /* description of target bit/pixmap */
FT_Outline outline; FT_Outline outline;
Long traceOfs; /* current offset in target bitmap */
Short traceIncr; /* sweep's increment in target bitmap */
/* dispatch variables */ /* dispatch variables */
Function_Sweep_Init* Proc_Sweep_Init; Function_Sweep_Init* Proc_Sweep_Init;
@ -2205,16 +2203,13 @@
*/ */
static void static void
Vertical_Sweep_Init( RAS_ARGS Short* min, Vertical_Sweep_Init( RAS_ARGS Short min,
Short* max ) Short max )
{ {
Long pitch = ras.target.pitch;
FT_UNUSED( max ); FT_UNUSED( max );
ras.traceIncr = (Short)-pitch; ras.bLine = ras.bOrigin - min * ras.target.pitch;
ras.traceOfs = -*min * pitch;
} }
@ -2276,7 +2271,7 @@
f1 = (Byte) ( 0xFF >> ( e1 & 7 ) ); f1 = (Byte) ( 0xFF >> ( e1 & 7 ) );
f2 = (Byte) ~( 0x7F >> ( e2 & 7 ) ); f2 = (Byte) ~( 0x7F >> ( e2 & 7 ) );
target = ras.bOrigin + ras.traceOfs + c1; target = ras.bLine + c1;
c2 -= c1; c2 -= c1;
if ( c2 > 0 ) if ( c2 > 0 )
@ -2428,8 +2423,8 @@
c1 = (Short)( e1 >> 3 ); c1 = (Short)( e1 >> 3 );
f1 = (Short)( e1 & 7 ); f1 = (Short)( e1 & 7 );
if ( e1 >= 0 && e1 < ras.bWidth && if ( e1 >= 0 && e1 < ras.bWidth &&
ras.bOrigin[ras.traceOfs + c1] & ( 0x80 >> f1 ) ) ras.bLine[c1] & ( 0x80 >> f1 ) )
goto Exit; goto Exit;
} }
else else
@ -2445,7 +2440,7 @@
c1 = (Short)( e1 >> 3 ); c1 = (Short)( e1 >> 3 );
f1 = (Short)( e1 & 7 ); f1 = (Short)( e1 & 7 );
ras.bOrigin[ras.traceOfs + c1] |= (char)( 0x80 >> f1 ); ras.bLine[c1] |= (char)( 0x80 >> f1 );
} }
Exit: Exit:
@ -2456,7 +2451,7 @@
static void static void
Vertical_Sweep_Step( RAS_ARG ) Vertical_Sweep_Step( RAS_ARG )
{ {
ras.traceOfs += ras.traceIncr; ras.bLine -= ras.target.pitch;
} }
@ -2470,8 +2465,8 @@
*/ */
static void static void
Horizontal_Sweep_Init( RAS_ARGS Short* min, Horizontal_Sweep_Init( RAS_ARGS Short min,
Short* max ) Short max )
{ {
/* nothing, really */ /* nothing, really */
FT_UNUSED_RASTER; FT_UNUSED_RASTER;
@ -2741,7 +2736,7 @@
/* now initialize the sweep */ /* now initialize the sweep */
ras.Proc_Sweep_Init( RAS_VARS &min_Y, &max_Y ); ras.Proc_Sweep_Init( RAS_VARS min_Y, max_Y );
/* then compute the distance of each profile from min_Y */ /* then compute the distance of each profile from min_Y */