[raster,smooth] Microoptimizations. * src/raster/ftraster.c (Insert_Y_Turn, Finalize_Profile_Table, Beziier_Up, ): Use do-while loops. * src/smooth/ftgrays.c (gray_render_scanline, gray_render_line, gray_convert_glyph): Ditto.
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 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135
diff --git a/ChangeLog b/ChangeLog
index 977473a..a6e6db3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2015-09-04 Alexei Podtelezhnikov <apodtele@gmail.com>
+
+ [raster,smooth] Microoptimizations.
+
+ * src/raster/ftraster.c (Insert_Y_Turn, Finalize_Profile_Table,
+ Beziier_Up, ): Use do-while loops.
+
+ * src/smooth/ftgrays.c (gray_render_scanline, gray_render_line,
+ gray_convert_glyph): Ditto.
+
2015-09-04 Werner Lemberg <wl@gnu.org>
[autofit] Redesign code ranges (2/2).
diff --git a/src/raster/ftraster.c b/src/raster/ftraster.c
index 8e9c794..1c51f91 100644
--- a/src/raster/ftraster.c
+++ b/src/raster/ftraster.c
@@ -801,15 +801,14 @@
/* if it is <, simply insert it, ignore if == */
if ( n >= 0 && y > y_turns[n] )
- while ( n >= 0 )
+ do
{
Int y2 = (Int)y_turns[n];
y_turns[n] = y;
y = y2;
- n--;
- }
+ } while ( --n >= 0 );
if ( n < 0 )
{
@@ -850,7 +849,7 @@
if ( n > 1 && p )
{
- while ( n > 0 )
+ do
{
Int bottom, top;
@@ -878,8 +877,7 @@
return FAILURE;
p = p->link;
- n--;
- }
+ } while ( --n );
}
else
ras.fProfile = NULL;
@@ -1250,7 +1248,7 @@
start_arc = arc;
- while ( arc >= start_arc && e <= e2 )
+ do
{
ras.joint = FALSE;
@@ -1283,7 +1281,7 @@
}
arc -= degree;
}
- }
+ } while ( arc >= start_arc && e <= e2 );
Fin:
ras.top = top;
diff --git a/src/smooth/ftgrays.c b/src/smooth/ftgrays.c
index a9317e9..e4559b9 100644
--- a/src/smooth/ftgrays.c
+++ b/src/smooth/ftgrays.c
@@ -758,7 +758,7 @@ typedef ptrdiff_t FT_PtrDist;
mod -= (int)dx;
- while ( ex1 != ex2 )
+ do
{
delta = lift;
mod += rem;
@@ -773,7 +773,7 @@ typedef ptrdiff_t FT_PtrDist;
y1 += delta;
ex1 += incr;
gray_set_cell( RAS_VAR_ ex1, ey );
- }
+ } while ( ex1 != ex2 );
}
delta = y2 - y1;
@@ -896,7 +896,7 @@ typedef ptrdiff_t FT_PtrDist;
FT_DIV_MOD( int, p, dy, lift, rem );
mod -= (int)dy;
- while ( ey1 != ey2 )
+ do
{
delta = lift;
mod += rem;
@@ -914,7 +914,7 @@ typedef ptrdiff_t FT_PtrDist;
ey1 += incr;
gray_set_cell( RAS_VAR_ TRUNC( x ), ey1 );
- }
+ } while ( ey1 != ey2 );
}
gray_render_scanline( RAS_VAR_ ey1, x,
@@ -1847,7 +1847,7 @@ typedef ptrdiff_t FT_PtrDist;
bands[0].max = max;
band = bands;
- while ( band >= bands )
+ do
{
TPos bottom, top, middle;
int error;
@@ -1923,7 +1923,7 @@ typedef ptrdiff_t FT_PtrDist;
band[0].min = middle;
band[0].max = top;
band++;
- }
+ } while ( band >= bands );
}
if ( ras.band_shoot > 8 && ras.band_size > 16 )