[smooth] Minor fixes. * src/smooth/ftgrays.c (gray_render_conic): Move variable and structure declarations to beginning of function. Inspite of C99 compliance we still do this for the sake of backward compatibility. This also avoids a shadowing declaration of `count`. (gray_convert_glyph_inner): Fix typo.
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 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164
diff --git a/ChangeLog b/ChangeLog
index b7daa70..de666fa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2021-07-16 Werner Lemberg <wl@gnu.org>
+
+ [smooth] Minor fixes.
+
+ * src/smooth/ftgrays.c (gray_render_conic): Move variable and
+ structure declarations to beginning of function. Inspite of C99
+ compliance we still do this for the sake of backward compatibility.
+ This also avoids a shadowing declaration of `count`.
+ (gray_convert_glyph_inner): Fix typo.
+
2021-07-15 Ben Wagner <bungeman@chromium.org>
* src/smooth/ftgrays.c: Guard inclusion of `emmintrin.h`.
diff --git a/src/smooth/ftgrays.c b/src/smooth/ftgrays.c
index b802030..e5f36a0 100644
--- a/src/smooth/ftgrays.c
+++ b/src/smooth/ftgrays.c
@@ -1030,6 +1030,16 @@ typedef ptrdiff_t FT_PtrDist;
const FT_Vector* to )
{
FT_Vector p0, p1, p2;
+ TPos dx, dy;
+ int shift;
+
+ FT_Int64 ax, ay, bx, by;
+ FT_Int64 rx, ry;
+ FT_Int64 qx, qy;
+ FT_Int64 px, py;
+
+ FT_UInt count;
+
p0.x = ras.x;
p0.y = ras.y;
@@ -1051,8 +1061,8 @@ typedef ptrdiff_t FT_PtrDist;
return;
}
- TPos dx = FT_ABS( p0.x + p2.x - 2 * p1.x );
- TPos dy = FT_ABS( p0.y + p2.y - 2 * p1.y );
+ dx = FT_ABS( p0.x + p2.x - 2 * p1.x );
+ dy = FT_ABS( p0.y + p2.y - 2 * p1.y );
if ( dx < dy )
dx = dy;
@@ -1065,7 +1075,7 @@ typedef ptrdiff_t FT_PtrDist;
/* We can calculate the number of necessary bisections because */
/* each bisection predictably reduces deviation exactly 4-fold. */
/* Even 32-bit deviation would vanish after 16 bisections. */
- int shift = 0;
+ shift = 0;
do
{
dx >>= 2;
@@ -1127,33 +1137,43 @@ typedef ptrdiff_t FT_PtrDist;
} u;
+ union
+ {
+ struct { FT_Int32 px_lo, px_hi, py_lo, py_hi; } i;
+ __m128i vec;
+
+ } v;
+
+ __m128i a, b;
+ __m128i r, q, q2;
+ __m128i p;
+
+
u.i.ax = p0.x + p2.x - 2 * p1.x;
u.i.ay = p0.y + p2.y - 2 * p1.y;
u.i.bx = p1.x - p0.x;
u.i.by = p1.y - p0.y;
- __m128i a = _mm_load_si128(&u.vec.a);
- __m128i b = _mm_load_si128(&u.vec.b);
+ a = _mm_load_si128( &u.vec.a );
+ b = _mm_load_si128( &u.vec.b );
- __m128i r = _mm_slli_epi64(a, 33 - 2 * shift);
- __m128i q = _mm_slli_epi64(b, 33 - shift);
- __m128i q2 = _mm_slli_epi64(a, 32 - 2 * shift);
- q = _mm_add_epi64(q2, q);
+ r = _mm_slli_epi64( a, 33 - 2 * shift );
+ q = _mm_slli_epi64( b, 33 - shift );
+ q2 = _mm_slli_epi64( a, 32 - 2 * shift );
+
+ q = _mm_add_epi64( q2, q );
- union {
- struct { FT_Int32 px_lo, px_hi, py_lo, py_hi; } i;
- __m128i vec;
- } v;
v.i.px_lo = 0;
v.i.px_hi = p0.x;
v.i.py_lo = 0;
v.i.py_hi = p0.y;
- __m128i p = _mm_load_si128(&v.vec);
+ p = _mm_load_si128( &v.vec );
- for (unsigned count = (1u << shift); count > 0; count--) {
- p = _mm_add_epi64(p, q);
- q = _mm_add_epi64(q, r);
+ for ( count = ( 1U << shift ); count > 0; count-- )
+ {
+ p = _mm_add_epi64( p, q );
+ q = _mm_add_epi64( q, r );
_mm_store_si128( &v.vec, p );
@@ -1162,24 +1182,24 @@ typedef ptrdiff_t FT_PtrDist;
return;
}
-#endif /* !__SSE2__ */
- FT_Int64 ax = p0.x + p2.x - 2 * p1.x;
- FT_Int64 ay = p0.y + p2.y - 2 * p1.y;
- FT_Int64 bx = p1.x - p0.x;
- FT_Int64 by = p1.y - p0.y;
+#endif /* __SSE2__ */
- FT_Int64 rx = ax << (33 - 2 * shift);
- FT_Int64 ry = ay << (33 - 2 * shift);
+ ax = p0.x + p2.x - 2 * p1.x;
+ ay = p0.y + p2.y - 2 * p1.y;
+ bx = p1.x - p0.x;
+ by = p1.y - p0.y;
- FT_Int64 qx = (bx << (33 - shift)) + (ax << (32 - 2 * shift));
- FT_Int64 qy = (by << (33 - shift)) + (ay << (32 - 2 * shift));
+ rx = ax << ( 33 - 2 * shift );
+ ry = ay << ( 33 - 2 * shift );
- FT_Int64 px = (FT_Int64)p0.x << 32;
- FT_Int64 py = (FT_Int64)p0.y << 32;
+ qx = ( bx << ( 33 - shift ) ) + ( ax << ( 32 - 2 * shift ) );
+ qy = ( by << ( 33 - shift ) ) + ( ay << ( 32 - 2 * shift ) );
- FT_UInt count = 1u << shift;
+ px = (FT_Int64)p0.x << 32;
+ py = (FT_Int64)p0.y << 32;
- for (; count > 0; count--) {
+ for ( count = 1U << shift; count > 0; count-- )
+ {
px += qx;
py += qy;
qx += rx;
@@ -1879,7 +1899,7 @@ typedef ptrdiff_t FT_PtrDist;
FT_TRACE7(( "band [%d..%d]: %ld cell%s\n",
ras.min_ey,
ras.max_ey,
- ras.cell_free - ras.cells.,
+ ras.cell_free - ras.cells,
ras.cell_free - ras.cells == 1 ? "" : "s" ));
}
else