Skip to content

Commit

Permalink
* src/smooth/ftgrays.c (gray_sweep): Improve code.
Browse files Browse the repository at this point in the history
Signed-off-by: mydongistiny <[email protected]>
  • Loading branch information
apodtele authored and mydongistiny committed Mar 7, 2017
1 parent 5dc5daa commit 2e1d5b3
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions src/smooth/ftgrays.c
Original file line number Diff line number Diff line change
Expand Up @@ -568,9 +568,6 @@ typedef ptrdiff_t FT_PtrDist;
/* Note that if a cell is to the left of the clipping region, it is */
/* actually set to the (min_ex-1) horizontal position. */

/* All cells that are on the left of the clipping region go to the */
/* min_ex - 1 horizontal position. */

if ( ex < ras.min_ex )
ex = ras.min_ex - 1;

Expand Down Expand Up @@ -1304,21 +1301,18 @@ typedef ptrdiff_t FT_PtrDist;
for ( y = ras.min_ey; y < ras.max_ey; y++ )
{
PCell cell = ras.ycells[y - ras.min_ey];
TCoord cover = 0;
TCoord x = ras.min_ex;
TArea cover = 0;
TArea area;


for ( ; cell != NULL; cell = cell->next )
{
TArea area;


if ( cover != 0 && cell->x > x )
gray_hline( RAS_VAR_ x, y, (TArea)cover * ( ONE_PIXEL * 2 ),
cell->x - x );
gray_hline( RAS_VAR_ x, y, cover, cell->x - x );

cover += cell->cover;
area = (TArea)cover * ( ONE_PIXEL * 2 ) - cell->area;
cover += (TArea)cell->cover * ( ONE_PIXEL * 2 );
area = cover - cell->area;

if ( area != 0 && cell->x >= ras.min_ex )
gray_hline( RAS_VAR_ cell->x, y, area, 1 );
Expand All @@ -1327,8 +1321,7 @@ typedef ptrdiff_t FT_PtrDist;
}

if ( cover != 0 )
gray_hline( RAS_VAR_ x, y, (TArea)cover * ( ONE_PIXEL * 2 ),
ras.max_ex - x );
gray_hline( RAS_VAR_ x, y, cover, ras.max_ex - x );
}

FT_TRACE7(( "gray_sweep: end\n" ));
Expand Down

0 comments on commit 2e1d5b3

Please sign in to comment.