ref: f44ddfda45eaded9956f46ad1c531b61d8447eef
parent: e73055c791776ec35cb43c39614d35ec5fd99539
author: Alexei Podtelezhnikov <[email protected]>
date: Tue Aug 30 19:21:23 EDT 2016
[smooth] Streamline pixmap drawing a bit more. Zero coverage is unlikely (1 out of 256) to warrant checking. This gives 0.5% speed improvement in dendering simple glyphs. * src/smooth/ftgrays.c (gray_hline, gray_render_span): Remove checks.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2016-08-30 Alexei Podtelezhnikov <[email protected]>
+
+ [smooth] Streamline pixmap drawing a bit more.
+
+ Zero coverage is unlikely (1 out of 256) to warrant checking. This
+ gives 0.5% speed improvement in dendering simple glyphs.
+
+ * src/smooth/ftgrays.c (gray_hline, gray_render_span): Remove checks.
+
2016-08-29 Alexei Podtelezhnikov <[email protected]>
[smooth] Streamline pixmap drawing.
--- a/src/smooth/ftgrays.c
+++ b/src/smooth/ftgrays.c
@@ -1281,31 +1281,26 @@
for ( ; count > 0; count--, spans++ )
{
- unsigned char coverage = spans->coverage;
+ unsigned char coverage = spans->coverage;
+ unsigned char* q = p + spans->x;
- if ( coverage )
+ /* For small-spans it is faster to do it by ourselves than
+ * calling `memset'. This is mainly due to the cost of the
+ * function call.
+ */
+ switch ( spans->len )
{
- unsigned char* q = p + spans->x;
-
-
- /* For small-spans it is faster to do it by ourselves than
- * calling `memset'. This is mainly due to the cost of the
- * function call.
- */
- switch ( spans->len )
- {
- case 7: *q++ = coverage;
- case 6: *q++ = coverage;
- case 5: *q++ = coverage;
- case 4: *q++ = coverage;
- case 3: *q++ = coverage;
- case 2: *q++ = coverage;
- case 1: *q = coverage;
- case 0: break;
- default:
- FT_MEM_SET( q, coverage, spans->len );
- }
+ case 7: *q++ = coverage;
+ case 6: *q++ = coverage;
+ case 5: *q++ = coverage;
+ case 4: *q++ = coverage;
+ case 3: *q++ = coverage;
+ case 2: *q++ = coverage;
+ case 1: *q = coverage;
+ case 0: break;
+ default:
+ FT_MEM_SET( q, coverage, spans->len );
}
}
}
@@ -1317,7 +1312,8 @@
TArea area,
TCoord acount )
{
- int coverage;
+ int coverage;
+ FT_Span span;
/* compute the coverage line's coverage, depending on the */
@@ -1346,17 +1342,11 @@
coverage = 255;
}
- if ( coverage )
- {
- FT_Span span;
+ span.x = (short)( x + ras.min_ex );
+ span.len = (unsigned short)acount;
+ span.coverage = (unsigned char)coverage;
-
- span.x = (short)( x + ras.min_ex );
- span.len = (unsigned short)acount;
- span.coverage = (unsigned char)coverage;
-
- ras.render_span( y + ras.min_ey, 1, &span, ras.render_span_data );
- }
+ ras.render_span( y + ras.min_ey, 1, &span, ras.render_span_data );
}