[raster] Small optimizations.

* src/raster/ftraster.c (New_Profile): Set important fields only and
delay setting `gProfile` until...
(End_Profile): ... it is checked to be valid here.
(Convert_Glyph): Updated.
This commit is contained in:
Alexei Podtelezhnikov 2023-10-18 23:13:13 -04:00
parent a35da2c093
commit 4e61303a3b
1 changed files with 11 additions and 12 deletions

View File

@ -682,13 +682,11 @@
ras.error = FT_THROW( Raster_Overflow ); ras.error = FT_THROW( Raster_Overflow );
return FAILURE; return FAILURE;
} }
ras.cProfile->height = 0;
ras.cProfile->offset = ras.top;
} }
ras.cProfile->start = 0;
ras.cProfile->height = 0;
ras.cProfile->offset = ras.top;
ras.cProfile->link = NULL;
ras.cProfile->next = NULL;
ras.cProfile->flags = ras.dropOutControl; ras.cProfile->flags = ras.dropOutControl;
switch ( aState ) switch ( aState )
@ -713,9 +711,6 @@
return FAILURE; return FAILURE;
} }
if ( !ras.gProfile )
ras.gProfile = ras.cProfile;
ras.state = aState; ras.state = aState;
ras.fresh = TRUE; ras.fresh = TRUE;
ras.joint = FALSE; ras.joint = FALSE;
@ -730,7 +725,7 @@
* End_Profile * End_Profile
* *
* @Description: * @Description:
* Finalize the current profile. * Finalize the current profile and record y-turns.
* *
* @Input: * @Input:
* overshoot :: * overshoot ::
@ -787,9 +782,12 @@
Insert_Y_Turn( RAS_VARS top + 1 ) ) Insert_Y_Turn( RAS_VARS top + 1 ) )
return FAILURE; return FAILURE;
if ( !ras.gProfile )
ras.gProfile = p;
/* preliminary values to be finalized */ /* preliminary values to be finalized */
p->link = (PProfile)ras.top;
p->next = ras.gProfile; p->next = ras.gProfile;
p->link = (PProfile)ras.top;
ras.num_Profs++; ras.num_Profs++;
} }
@ -816,6 +814,7 @@
PProfile q; PProfile q;
/* there should be at least two profiles, up and down */
while ( --n ) while ( --n )
{ {
q = p->link; q = p->link;
@ -1990,11 +1989,11 @@
if ( End_Profile( RAS_VARS o ) ) if ( End_Profile( RAS_VARS o ) )
return FAILURE; return FAILURE;
if ( !ras.fProfile && ras.num_Profs ) if ( !ras.fProfile )
ras.fProfile = ras.gProfile; ras.fProfile = ras.gProfile;
} }
if ( ras.num_Profs ) if ( ras.fProfile )
Finalize_Profile_Table( RAS_VAR ); Finalize_Profile_Table( RAS_VAR );
return SUCCESS; return SUCCESS;