* src/smooth/ftgrays.c (gray_render_conic): Refactor redundancy.
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
diff --git a/src/smooth/ftgrays.c b/src/smooth/ftgrays.c
index 3179602..8988e79 100644
--- a/src/smooth/ftgrays.c
+++ b/src/smooth/ftgrays.c
@@ -1023,10 +1023,9 @@ typedef ptrdiff_t FT_PtrDist;
const FT_Vector* to )
{
FT_Vector p0, p1, p2;
- TPos dx, dy;
+ TPos ax, ay, bx, by, dx, dy;
int shift;
- FT_Int64 ax, ay, bx, by;
FT_Int64 rx, ry;
FT_Int64 qx, qy;
FT_Int64 px, py;
@@ -1054,8 +1053,13 @@ typedef ptrdiff_t FT_PtrDist;
return;
}
- dx = FT_ABS( p0.x + p2.x - 2 * p1.x );
- dy = FT_ABS( p0.y + p2.y - 2 * p1.y );
+ bx = p1.x - p0.x;
+ by = p1.y - p0.y;
+ ax = p2.x - p1.x - bx; /* p0.x + p2.x - 2 * p1.x */
+ ay = p2.y - p1.y - by; /* p0.y + p2.y - 2 * p1.y */
+
+ dx = FT_ABS( ax );
+ dy = FT_ABS( ay );
if ( dx < dy )
dx = dy;
@@ -1144,10 +1148,10 @@ typedef ptrdiff_t FT_PtrDist;
__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;
+ u.i.ax = ax;
+ u.i.ay = ay;
+ u.i.bx = bx;
+ u.i.by = by;
a = _mm_load_si128( &u.vec.a );
b = _mm_load_si128( &u.vec.b );
@@ -1165,7 +1169,7 @@ typedef ptrdiff_t FT_PtrDist;
p = _mm_load_si128( &v.vec );
- for ( count = ( 1U << shift ); count > 0; count-- )
+ for ( count = 1U << shift; count > 0; count-- )
{
p = _mm_add_epi64( p, q );
q = _mm_add_epi64( q, r );
@@ -1179,11 +1183,6 @@ typedef ptrdiff_t FT_PtrDist;
}
#endif /* __SSE2__ */
- 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;
-
rx = LEFT_SHIFT( ax, 33 - 2 * shift );
ry = LEFT_SHIFT( ay, 33 - 2 * shift );