[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.
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 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
diff --git a/ChangeLog b/ChangeLog
index c3cb03a..7174508 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2016-08-30 Alexei Podtelezhnikov <apodtele@gmail.com>
+
+ [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 <apodtele@gmail.com>
[smooth] Streamline pixmap drawing.
diff --git a/src/smooth/ftgrays.c b/src/smooth/ftgrays.c
index 814749b..7034f16 100644
--- a/src/smooth/ftgrays.c
+++ b/src/smooth/ftgrays.c
@@ -1281,31 +1281,26 @@ typedef ptrdiff_t FT_PtrDist;
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 @@ typedef ptrdiff_t FT_PtrDist;
TArea area,
TCoord acount )
{
- int coverage;
+ int coverage;
+ FT_Span span;
/* compute the coverage line's coverage, depending on the */
@@ -1346,17 +1342,11 @@ typedef ptrdiff_t FT_PtrDist;
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 );
}