small speed-up to the anti-aliased renderer
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
diff --git a/ChangeLog b/ChangeLog
index c48fb80..c6456e9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2002-01-09 Maxim Shemanarev <mcseemagg@yahoo.com>
+
+ * src/smooth/ftgrays.c (gray_render_line): small optimisation to
+ the smooth anti-aliased renderer that deals with vertical segments.
+ This results in a 5-7% speedup in rendering speed..
+
2002-01-08 David Turner <david@freetype.org>
* configure, install: added some wrapper scripts to make
diff --git a/src/smooth/ftgrays.c b/src/smooth/ftgrays.c
index d935338..edd8b0e 100644
--- a/src/smooth/ftgrays.c
+++ b/src/smooth/ftgrays.c
@@ -635,6 +635,45 @@
goto End;
}
+ /* vertical line - avoids calling gray_render_scanline */
+ incr = 1;
+
+ if( dx == 0 )
+ {
+ TScan ex = TRUNC( ras.x );
+ TScan two_fx = ( ras.x - SUBPIXELS( ex ) ) << 1;
+ TPos area;
+
+ first = ONE_PIXEL;
+ if( dy < 0 )
+ {
+ first = 0;
+ incr = -1;
+ }
+
+ delta = first - fy1;
+ ras.area += (TArea)two_fx * delta;
+ ras.cover += delta;
+ ey1 += incr;
+
+ gray_set_cell( raster, ex, ey1 );
+
+ delta = first + first - ONE_PIXEL;
+ area = (TArea)two_fx * delta;
+ while( ey1 != ey2 )
+ {
+ ras.area += area;
+ ras.cover += delta;
+ ey1 += incr;
+ gray_set_cell( raster, ex, ey1 );
+ }
+
+ delta = fy2 - ONE_PIXEL + first;
+ ras.area += (TArea)two_fx * delta;
+ ras.cover += delta;
+ goto End;
+ }
+
/* ok, we have to render several scanlines */
p = ( ONE_PIXEL - fy1 ) * dx;
first = ONE_PIXEL;