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