* src/smooth/ftgrays.c (gray_convert_glyph): Refactor for convenience.

This commit is contained in:
Alexei Podtelezhnikov 2024-04-14 15:12:31 -04:00
parent 674d629b5e
commit fff58f5424
1 changed files with 14 additions and 13 deletions

View File

@ -1907,23 +1907,24 @@ typedef ptrdiff_t FT_PtrDist;
do do
{ {
TCoord width = band[0] - band[1]; TCoord i;
TCoord w;
int error; int error;
for ( w = 0; w < width; ++w ) ras.min_ey = band[1];
ras.ycells[w] = ras.cell_null; ras.max_ey = band[0];
/* memory management: skip ycells */ ras.count_ey = ras.max_ey - ras.min_ey;
n = ( (size_t)width * sizeof ( PCell ) + sizeof ( TCell ) - 1 ) /
sizeof ( TCell ); /* memory management: zero out and skip ycells */
for ( i = 0; i < ras.count_ey; ++i )
ras.ycells[i] = ras.cell_null;
n = ( (size_t)ras.count_ey * sizeof ( PCell ) + sizeof ( TCell ) - 1 )
/ sizeof ( TCell );
ras.cell_free = buffer + n; ras.cell_free = buffer + n;
ras.cell = ras.cell_null; ras.cell = ras.cell_null;
ras.min_ey = band[1];
ras.max_ey = band[0];
ras.count_ey = width;
error = gray_convert_glyph_inner( RAS_VAR_ continued ); error = gray_convert_glyph_inner( RAS_VAR_ continued );
continued = 1; continued = 1;
@ -1941,10 +1942,10 @@ typedef ptrdiff_t FT_PtrDist;
return error; return error;
/* render pool overflow; we will reduce the render band by half */ /* render pool overflow; we will reduce the render band by half */
width >>= 1; i = ( band[0] - band[1] ) >> 1;
/* this should never happen even with tiny rendering pool */ /* this should never happen even with tiny rendering pool */
if ( width == 0 ) if ( i == 0 )
{ {
FT_TRACE7(( "gray_convert_glyph: rotten glyph\n" )); FT_TRACE7(( "gray_convert_glyph: rotten glyph\n" ));
return FT_THROW( Raster_Overflow ); return FT_THROW( Raster_Overflow );
@ -1952,7 +1953,7 @@ typedef ptrdiff_t FT_PtrDist;
band++; band++;
band[1] = band[0]; band[1] = band[0];
band[0] += width; band[0] += i;
} while ( band >= bands ); } while ( band >= bands );
} }