forked from minhngoc25a/freetype2
* src/smooth/ftgrays.c (gray_hline): Improve code.
This commit is contained in:
parent
73a7ce3d00
commit
761d9e418b
|
@ -1,3 +1,7 @@
|
|||
2017-02-22 Alexei Podtelezhnikov <apodtele@gmail.com>
|
||||
|
||||
* src/smooth/ftgrays.c (gray_hline): Improve code.
|
||||
|
||||
2017-02-20 Dominik Röttsches <drott@google.com>
|
||||
|
||||
Fix some `ttnameid.h' entries (#50313).
|
||||
|
|
|
@ -1222,31 +1222,21 @@ typedef ptrdiff_t FT_PtrDist;
|
|||
static void
|
||||
gray_hline( RAS_ARG_ TCoord x,
|
||||
TCoord y,
|
||||
TArea area,
|
||||
TArea coverage,
|
||||
TCoord acount )
|
||||
{
|
||||
int coverage;
|
||||
FT_Span span;
|
||||
|
||||
|
||||
/* compute the coverage line's coverage, depending on the */
|
||||
/* outline fill rule */
|
||||
/* */
|
||||
/* the coverage percentage is area/(PIXEL_BITS*PIXEL_BITS*2) */
|
||||
/* */
|
||||
coverage = (int)( area >> ( PIXEL_BITS * 2 + 1 - 8 ) );
|
||||
/* use range 0..256 */
|
||||
/* scale the coverage from 0..(ONE_PIXEL*ONE_PIXEL*2) to 0..256 */
|
||||
coverage >>= PIXEL_BITS * 2 + 1 - 8;
|
||||
if ( coverage < 0 )
|
||||
coverage = -coverage;
|
||||
coverage = -coverage - 1;
|
||||
|
||||
/* compute the line's coverage depending on the outline fill rule */
|
||||
if ( ras.outline.flags & FT_OUTLINE_EVEN_ODD_FILL )
|
||||
{
|
||||
coverage &= 511;
|
||||
|
||||
if ( coverage > 256 )
|
||||
coverage = 512 - coverage;
|
||||
else if ( coverage == 256 )
|
||||
coverage = 255;
|
||||
if ( coverage >= 256 )
|
||||
coverage = 511 - coverage;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1257,6 +1247,9 @@ typedef ptrdiff_t FT_PtrDist;
|
|||
|
||||
if ( ras.render_span ) /* for FT_RASTER_FLAG_DIRECT only */
|
||||
{
|
||||
FT_Span span;
|
||||
|
||||
|
||||
span.x = (short)x;
|
||||
span.len = (unsigned short)acount;
|
||||
span.coverage = (unsigned char)coverage;
|
||||
|
|
Loading…
Reference in New Issue