[smooth] Another tiny speed-up.

* src/smooth/ftgrays.c (gray_find_cell): Merge into...
(gray_record_cell): ... this function.
This commit is contained in:
Alexei Podtelezhnikov 2016-09-14 23:15:03 -04:00
parent c38be52bf8
commit ad47550b80
2 changed files with 18 additions and 20 deletions

View File

@ -1,3 +1,10 @@
2016-09-14 Alexei Podtelezhnikov <apodtele@gmail.com>
[smooth] Another tiny speed-up.
* src/smooth/ftgrays.c (gray_find_cell): Merge into...
(gray_record_cell): ... this function.
2016-09-11 Alexei Podtelezhnikov <apodtele@gmail.com> 2016-09-11 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/smooth/ftgrays.c (gray_{find,set}_cell): Remove dubious code. * src/smooth/ftgrays.c (gray_{find,set}_cell): Remove dubious code.

View File

@ -504,8 +504,8 @@ typedef ptrdiff_t FT_PtrDist;
/* */ /* */
/* Record the current cell in the table. */ /* Record the current cell in the table. */
/* */ /* */
static PCell static void
gray_find_cell( RAS_ARG ) gray_record_cell( RAS_ARG )
{ {
PCell *pcell, cell; PCell *pcell, cell;
TCoord x = ras.ex; TCoord x = ras.ex;
@ -519,7 +519,7 @@ typedef ptrdiff_t FT_PtrDist;
break; break;
if ( cell->x == x ) if ( cell->x == x )
goto Exit; goto Found;
pcell = &cell->next; pcell = &cell->next;
} }
@ -527,30 +527,21 @@ typedef ptrdiff_t FT_PtrDist;
if ( ras.num_cells >= ras.max_cells ) if ( ras.num_cells >= ras.max_cells )
ft_longjmp( ras.jump_buffer, 1 ); ft_longjmp( ras.jump_buffer, 1 );
/* insert new cell */
cell = ras.cells + ras.num_cells++; cell = ras.cells + ras.num_cells++;
cell->x = x; cell->x = x;
cell->area = 0; cell->area = ras.area;
cell->cover = 0; cell->cover = ras.cover;
cell->next = *pcell; cell->next = *pcell;
*pcell = cell; *pcell = cell;
Exit: return;
return cell;
}
Found:
static void /* update old cell */
gray_record_cell( RAS_ARG ) cell->area += ras.area;
{ cell->cover += ras.cover;
if ( ras.area | ras.cover )
{
PCell cell = gray_find_cell( RAS_VAR );
cell->area += ras.area;
cell->cover += ras.cover;
}
} }