ref: 761d9e418bb76499cf9d12bfbddf8e7ae7ff96fb
parent: 73a7ce3d00c077f7b771a22d72759dc53239a8f4
author: Alexei Podtelezhnikov <[email protected]>
date: Wed Feb 22 17:41:36 EST 2017
* src/smooth/ftgrays.c (gray_hline): Improve code.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2017-02-22 Alexei Podtelezhnikov <[email protected]>
+
+ * src/smooth/ftgrays.c (gray_hline): Improve code.
+
2017-02-20 Dominik Röttsches <[email protected]>
Fix some `ttnameid.h' entries (#50313).
--- a/src/smooth/ftgrays.c
+++ b/src/smooth/ftgrays.c
@@ -1222,31 +1222,21 @@
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 @@
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;