*/*: Remove `OVERFLOW_' prefix.

This increases readability.
This commit is contained in:
Werner Lemberg 2017-06-09 11:21:58 +02:00
parent 7bffeacd7e
commit dcd8de272f
17 changed files with 421 additions and 491 deletions

View File

@ -1,3 +1,9 @@
2017-06-09 Werner Lemberg <wl@gnu.org>
*/*: Remove `OVERFLOW_' prefix.
This increases readability.
2017-06-07 Werner Lemberg <wl@gnu.org>
[cff, truetype] Integer overflows.

View File

@ -417,29 +417,29 @@ FT_BEGIN_HEADER
*
* Use with care!
*/
#define OVERFLOW_ADD_INT( a, b ) \
#define ADD_INT( a, b ) \
(FT_Int)( (FT_UInt)(a) + (FT_UInt)(b) )
#define OVERFLOW_SUB_INT( a, b ) \
#define SUB_INT( a, b ) \
(FT_Int)( (FT_UInt)(a) - (FT_UInt)(b) )
#define OVERFLOW_MUL_INT( a, b ) \
#define MUL_INT( a, b ) \
(FT_Int)( (FT_UInt)(a) * (FT_UInt)(b) )
#define NEG_INT( a ) \
(FT_Int)( -(FT_UInt)(a) )
#define OVERFLOW_ADD_LONG( a, b ) \
#define ADD_LONG( a, b ) \
(FT_Long)( (FT_ULong)(a) + (FT_ULong)(b) )
#define OVERFLOW_SUB_LONG( a, b ) \
#define SUB_LONG( a, b ) \
(FT_Long)( (FT_ULong)(a) - (FT_ULong)(b) )
#define OVERFLOW_MUL_LONG( a, b ) \
#define MUL_LONG( a, b ) \
(FT_Long)( (FT_ULong)(a) * (FT_ULong)(b) )
#define NEG_LONG( a ) \
(FT_Long)( -(FT_ULong)(a) )
#define OVERFLOW_ADD_INT32( a, b ) \
#define ADD_INT32( a, b ) \
(FT_Int32)( (FT_UInt32)(a) + (FT_UInt32)(b) )
#define OVERFLOW_SUB_INT32( a, b ) \
#define SUB_INT32( a, b ) \
(FT_Int32)( (FT_UInt32)(a) - (FT_UInt32)(b) )
#define OVERFLOW_MUL_INT32( a, b ) \
#define MUL_INT32( a, b ) \
(FT_Int32)( (FT_UInt32)(a) * (FT_UInt32)(b) )
#define NEG_INT32( a ) \
(FT_Int32)( -(FT_UInt32)(a) )

View File

@ -87,8 +87,7 @@
FT_EXPORT_DEF( FT_Fixed )
FT_RoundFix( FT_Fixed a )
{
return ( OVERFLOW_ADD_LONG( a,
0x8000L - ( a < 0 ) ) ) & ~0xFFFFL;
return ( ADD_LONG( a, 0x8000L - ( a < 0 ) ) ) & ~0xFFFFL;
}
@ -97,7 +96,7 @@
FT_EXPORT_DEF( FT_Fixed )
FT_CeilFix( FT_Fixed a )
{
return ( OVERFLOW_ADD_LONG( a, 0xFFFFL ) ) & ~0xFFFFL;
return ( ADD_LONG( a, 0xFFFFL ) ) & ~0xFFFFL;
}
@ -668,14 +667,14 @@
if ( !a || !b )
return;
xx = OVERFLOW_ADD_LONG( FT_MulFix( a->xx, b->xx ),
FT_MulFix( a->xy, b->yx ) );
xy = OVERFLOW_ADD_LONG( FT_MulFix( a->xx, b->xy ),
FT_MulFix( a->xy, b->yy ) );
yx = OVERFLOW_ADD_LONG( FT_MulFix( a->yx, b->xx ),
FT_MulFix( a->yy, b->yx ) );
yy = OVERFLOW_ADD_LONG( FT_MulFix( a->yx, b->xy ),
FT_MulFix( a->yy, b->yy ) );
xx = ADD_LONG( FT_MulFix( a->xx, b->xx ),
FT_MulFix( a->xy, b->yx ) );
xy = ADD_LONG( FT_MulFix( a->xx, b->xy ),
FT_MulFix( a->xy, b->yy ) );
yx = ADD_LONG( FT_MulFix( a->yx, b->xx ),
FT_MulFix( a->yy, b->yx ) );
yy = ADD_LONG( FT_MulFix( a->yx, b->xy ),
FT_MulFix( a->yy, b->yy ) );
b->xx = xx;
b->xy = xy;
@ -730,14 +729,14 @@
if ( !a || !b )
return;
xx = OVERFLOW_ADD_LONG( FT_MulDiv( a->xx, b->xx, val ),
FT_MulDiv( a->xy, b->yx, val ) );
xy = OVERFLOW_ADD_LONG( FT_MulDiv( a->xx, b->xy, val ),
FT_MulDiv( a->xy, b->yy, val ) );
yx = OVERFLOW_ADD_LONG( FT_MulDiv( a->yx, b->xx, val ),
FT_MulDiv( a->yy, b->yx, val ) );
yy = OVERFLOW_ADD_LONG( FT_MulDiv( a->yx, b->xy, val ),
FT_MulDiv( a->yy, b->yy, val ) );
xx = ADD_LONG( FT_MulDiv( a->xx, b->xx, val ),
FT_MulDiv( a->xy, b->yx, val ) );
xy = ADD_LONG( FT_MulDiv( a->xx, b->xy, val ),
FT_MulDiv( a->xy, b->yy, val ) );
yx = ADD_LONG( FT_MulDiv( a->yx, b->xx, val ),
FT_MulDiv( a->yy, b->yx, val ) );
yy = ADD_LONG( FT_MulDiv( a->yx, b->xy, val ),
FT_MulDiv( a->yy, b->yy, val ) );
b->xx = xx;
b->xy = xy;
@ -761,10 +760,10 @@
if ( !vector || !matrix )
return;
xz = OVERFLOW_ADD_LONG( FT_MulDiv( vector->x, matrix->xx, val ),
FT_MulDiv( vector->y, matrix->xy, val ) );
yz = OVERFLOW_ADD_LONG( FT_MulDiv( vector->x, matrix->yx, val ),
FT_MulDiv( vector->y, matrix->yy, val ) );
xz = ADD_LONG( FT_MulDiv( vector->x, matrix->xx, val ),
FT_MulDiv( vector->y, matrix->xy, val ) );
yz = ADD_LONG( FT_MulDiv( vector->x, matrix->yx, val ),
FT_MulDiv( vector->y, matrix->yy, val ) );
vector->x = xz;
vector->y = yz;
@ -928,11 +927,11 @@
/* we silently ignore overflow errors, since such large values */
/* lead to even more (harmless) rendering errors later on */
if ( OVERFLOW_ADD_LONG( FT_ABS( in_x ), FT_ABS( out_y ) ) <= 131071L &&
OVERFLOW_ADD_LONG( FT_ABS( in_y ), FT_ABS( out_x ) ) <= 131071L )
if ( ADD_LONG( FT_ABS( in_x ), FT_ABS( out_y ) ) <= 131071L &&
ADD_LONG( FT_ABS( in_y ), FT_ABS( out_x ) ) <= 131071L )
{
FT_Long z1 = OVERFLOW_MUL_LONG( in_x, out_y );
FT_Long z2 = OVERFLOW_MUL_LONG( in_y, out_x );
FT_Long z1 = MUL_LONG( in_x, out_y );
FT_Long z2 = MUL_LONG( in_y, out_x );
if ( z1 > z2 )

View File

@ -581,36 +581,36 @@
metrics->horiBearingX = FT_PIX_FLOOR( metrics->horiBearingX );
metrics->horiBearingY = FT_PIX_CEIL ( metrics->horiBearingY );
right = FT_PIX_CEIL( OVERFLOW_ADD_LONG( metrics->vertBearingX,
metrics->width ) );
bottom = FT_PIX_CEIL( OVERFLOW_ADD_LONG( metrics->vertBearingY,
metrics->height ) );
right = FT_PIX_CEIL( ADD_LONG( metrics->vertBearingX,
metrics->width ) );
bottom = FT_PIX_CEIL( ADD_LONG( metrics->vertBearingY,
metrics->height ) );
metrics->vertBearingX = FT_PIX_FLOOR( metrics->vertBearingX );
metrics->vertBearingY = FT_PIX_FLOOR( metrics->vertBearingY );
metrics->width = OVERFLOW_SUB_LONG( right,
metrics->vertBearingX );
metrics->height = OVERFLOW_SUB_LONG( bottom,
metrics->vertBearingY );
metrics->width = SUB_LONG( right,
metrics->vertBearingX );
metrics->height = SUB_LONG( bottom,
metrics->vertBearingY );
}
else
{
metrics->vertBearingX = FT_PIX_FLOOR( metrics->vertBearingX );
metrics->vertBearingY = FT_PIX_FLOOR( metrics->vertBearingY );
right = FT_PIX_CEIL ( OVERFLOW_ADD_LONG( metrics->horiBearingX,
metrics->width ) );
bottom = FT_PIX_FLOOR( OVERFLOW_SUB_LONG( metrics->horiBearingY,
metrics->height ) );
right = FT_PIX_CEIL ( ADD_LONG( metrics->horiBearingX,
metrics->width ) );
bottom = FT_PIX_FLOOR( SUB_LONG( metrics->horiBearingY,
metrics->height ) );
metrics->horiBearingX = FT_PIX_FLOOR( metrics->horiBearingX );
metrics->horiBearingY = FT_PIX_CEIL ( metrics->horiBearingY );
metrics->width = OVERFLOW_SUB_LONG( right,
metrics->horiBearingX );
metrics->height = OVERFLOW_SUB_LONG( metrics->horiBearingY,
bottom );
metrics->width = SUB_LONG( right,
metrics->horiBearingX );
metrics->height = SUB_LONG( metrics->horiBearingY,
bottom );
}
metrics->horiAdvance = FT_PIX_ROUND( metrics->horiAdvance );

View File

@ -1088,9 +1088,8 @@
v_cur.x = points[n].x >> xshift;
v_cur.y = points[n].y >> yshift;
area = OVERFLOW_ADD_LONG(
area,
( v_cur.y - v_prev.y ) * ( v_cur.x + v_prev.x ) );
area = ADD_LONG( area,
( v_cur.y - v_prev.y ) * ( v_cur.x + v_prev.x ) );
v_prev = v_cur;
}

View File

@ -194,9 +194,8 @@
blues->zone[blues->count].csTopEdge =
cf2_blueToFixed( blueValues[i + 1] );
zoneHeight = OVERFLOW_SUB_INT32(
blues->zone[blues->count].csTopEdge,
blues->zone[blues->count].csBottomEdge );
zoneHeight = SUB_INT32( blues->zone[blues->count].csTopEdge,
blues->zone[blues->count].csBottomEdge );
if ( zoneHeight < 0 )
{
@ -302,8 +301,7 @@
/* top edge */
flatFamilyEdge = cf2_blueToFixed( familyOtherBlues[j + 1] );
diff = cf2_fixedAbs( OVERFLOW_SUB_INT32( flatEdge,
flatFamilyEdge ) );
diff = cf2_fixedAbs( SUB_INT32( flatEdge, flatFamilyEdge ) );
if ( diff < minDiff && diff < csUnitsPerPixel )
{
@ -321,8 +319,7 @@
/* top edge */
flatFamilyEdge = cf2_blueToFixed( familyBlues[1] );
diff = cf2_fixedAbs( OVERFLOW_SUB_INT32( flatEdge,
flatFamilyEdge ) );
diff = cf2_fixedAbs( SUB_INT32( flatEdge, flatFamilyEdge ) );
if ( diff < minDiff && diff < csUnitsPerPixel )
blues->zone[i].csFlatEdge = flatFamilyEdge;
@ -345,8 +342,7 @@
/* adjust edges of top zone upward by twice darkening amount */
flatFamilyEdge += 2 * font->darkenY; /* bottom edge */
diff = cf2_fixedAbs( OVERFLOW_SUB_INT32( flatEdge,
flatFamilyEdge ) );
diff = cf2_fixedAbs( SUB_INT32( flatEdge, flatFamilyEdge ) );
if ( diff < minDiff && diff < csUnitsPerPixel )
{
@ -503,8 +499,8 @@
if ( blues->suppressOvershoot )
dsNew = blues->zone[i].dsFlatEdge;
else if ( OVERFLOW_SUB_INT32( blues->zone[i].csTopEdge,
bottomHintEdge->csCoord ) >=
else if ( SUB_INT32( blues->zone[i].csTopEdge,
bottomHintEdge->csCoord ) >=
blues->blueShift )
{
/* guarantee minimum of 1 pixel overshoot */

View File

@ -447,7 +447,7 @@
/* choose a constant for StdHW that depends on font contrast */
stdHW = cf2_getStdHW( decoder );
if ( stdHW > 0 && font->stdVW > OVERFLOW_MUL_INT32( 2, stdHW ) )
if ( stdHW > 0 && font->stdVW > MUL_INT32( 2, stdHW ) )
font->stdHW = FT_DivFix( cf2_intToFixed( 75 ), emRatio );
else
{

View File

@ -267,10 +267,8 @@
if ( *hinted )
{
*x_scale = OVERFLOW_ADD_INT32( decoder->builder.glyph->x_scale,
32 ) / 64;
*y_scale = OVERFLOW_ADD_INT32( decoder->builder.glyph->y_scale,
32 ) / 64;
*x_scale = ADD_INT32( decoder->builder.glyph->x_scale, 32 ) / 64;
*y_scale = ADD_INT32( decoder->builder.glyph->y_scale, 32 ) / 64;
}
else
{

View File

@ -74,8 +74,8 @@
/* cross product of pt1 position from origin with pt2 position from */
/* pt1; we reduce the precision so that the result fits into 32 bits */
return ( x1 >> 16 ) * ( OVERFLOW_SUB_INT32( y2, y1 ) >> 16 ) -
( y1 >> 16 ) * ( OVERFLOW_SUB_INT32( x2, x1 ) >> 16 );
return ( x1 >> 16 ) * ( SUB_INT32( y2, y1 ) >> 16 ) -
( y1 >> 16 ) * ( SUB_INT32( x2, x1 ) >> 16 );
}
@ -105,7 +105,7 @@
stemHintArray,
indexStemHint );
width = OVERFLOW_SUB_INT32( stemHint->max, stemHint->min );
width = SUB_INT32( stemHint->max, stemHint->min );
if ( width == cf2_intToFixed( -21 ) )
{
@ -185,9 +185,9 @@
/* darkening. Bottoms are not changed; tops are incremented by twice */
/* `darkenY'. */
if ( cf2_hint_isTop( hint ) )
hint->csCoord = OVERFLOW_ADD_INT32( hint->csCoord, 2 * font->darkenY );
hint->csCoord = ADD_INT32( hint->csCoord, 2 * font->darkenY );
hint->csCoord = OVERFLOW_ADD_INT32( hint->csCoord, hintOrigin );
hint->csCoord = ADD_INT32( hint->csCoord, hintOrigin );
hint->scale = scale;
hint->index = indexStemHint; /* index in original stem hint array */
@ -331,11 +331,10 @@
if ( i == 0 && csCoord < hintmap->edge[0].csCoord )
{
/* special case for points below first edge: use uniform scale */
return OVERFLOW_ADD_INT32(
FT_MulFix( OVERFLOW_SUB_INT32( csCoord,
return ADD_INT32( FT_MulFix( SUB_INT32( csCoord,
hintmap->edge[0].csCoord ),
hintmap->scale ),
hintmap->edge[0].dsCoord );
hintmap->scale ),
hintmap->edge[0].dsCoord );
}
else
{
@ -343,11 +342,10 @@
* Note: entries with duplicate csCoord are allowed.
* Use edge[i], the highest entry where csCoord >= entry[i].csCoord
*/
return OVERFLOW_ADD_INT32(
FT_MulFix( OVERFLOW_SUB_INT32( csCoord,
return ADD_INT32( FT_MulFix( SUB_INT32( csCoord,
hintmap->edge[i].csCoord ),
hintmap->edge[i].scale ),
hintmap->edge[i].dsCoord );
hintmap->edge[i].scale ),
hintmap->edge[i].dsCoord );
}
}
}
@ -512,10 +510,9 @@
{
if ( hintmap->edge[i].csCoord != hintmap->edge[i - 1].csCoord )
hintmap->edge[i - 1].scale =
FT_DivFix(
OVERFLOW_SUB_INT32( hintmap->edge[i].dsCoord,
FT_DivFix( SUB_INT32( hintmap->edge[i].dsCoord,
hintmap->edge[i - 1].dsCoord ),
OVERFLOW_SUB_INT32( hintmap->edge[i].csCoord,
SUB_INT32( hintmap->edge[i].csCoord,
hintmap->edge[i - 1].csCoord ) );
}
@ -523,10 +520,9 @@
{
if ( hintmap->edge[j].csCoord != hintmap->edge[j - 1].csCoord )
hintmap->edge[j - 1].scale =
FT_DivFix(
OVERFLOW_SUB_INT32( hintmap->edge[j].dsCoord,
FT_DivFix( SUB_INT32( hintmap->edge[j].dsCoord,
hintmap->edge[j - 1].dsCoord ),
OVERFLOW_SUB_INT32( hintmap->edge[j].csCoord,
SUB_INT32( hintmap->edge[j].csCoord,
hintmap->edge[j - 1].csCoord ) );
i += 1; /* skip upper edge on next loop */
@ -647,13 +643,12 @@
CF2_Fixed midpoint =
cf2_hintmap_map(
hintmap->initialHintMap,
OVERFLOW_ADD_INT32( secondHintEdge->csCoord,
firstHintEdge->csCoord ) / 2 );
ADD_INT32( secondHintEdge->csCoord,
firstHintEdge->csCoord ) / 2 );
CF2_Fixed halfWidth =
FT_MulFix(
OVERFLOW_SUB_INT32( secondHintEdge->csCoord,
FT_MulFix( SUB_INT32( secondHintEdge->csCoord,
firstHintEdge->csCoord ) / 2,
hintmap->scale );
hintmap->scale );
firstHintEdge->dsCoord = midpoint - halfWidth;
@ -1106,18 +1101,18 @@
FT_Vector pt; /* hinted point in upright DS */
pt.x = OVERFLOW_ADD_INT32( FT_MulFix( glyphpath->scaleX, x ),
FT_MulFix( glyphpath->scaleC, y ) );
pt.x = ADD_INT32( FT_MulFix( glyphpath->scaleX, x ),
FT_MulFix( glyphpath->scaleC, y ) );
pt.y = cf2_hintmap_map( hintmap, y );
ppt->x = OVERFLOW_ADD_INT32(
ppt->x = ADD_INT32(
FT_MulFix( glyphpath->font->outerTransform.a, pt.x ),
OVERFLOW_ADD_INT32(
ADD_INT32(
FT_MulFix( glyphpath->font->outerTransform.c, pt.y ),
glyphpath->fractionalTranslation.x ) );
ppt->y = OVERFLOW_ADD_INT32(
ppt->y = ADD_INT32(
FT_MulFix( glyphpath->font->outerTransform.b, pt.x ),
OVERFLOW_ADD_INT32(
ADD_INT32(
FT_MulFix( glyphpath->font->outerTransform.d, pt.y ),
glyphpath->fractionalTranslation.y ) );
}
@ -1169,12 +1164,12 @@
CF2_Fixed denominator, s;
u.x = CF2_CS_SCALE( OVERFLOW_SUB_INT32( u2->x, u1->x ) );
u.y = CF2_CS_SCALE( OVERFLOW_SUB_INT32( u2->y, u1->y ) );
v.x = CF2_CS_SCALE( OVERFLOW_SUB_INT32( v2->x, v1->x ) );
v.y = CF2_CS_SCALE( OVERFLOW_SUB_INT32( v2->y, v1->y ) );
w.x = CF2_CS_SCALE( OVERFLOW_SUB_INT32( v1->x, u1->x ) );
w.y = CF2_CS_SCALE( OVERFLOW_SUB_INT32( v1->y, u1->y ) );
u.x = CF2_CS_SCALE( SUB_INT32( u2->x, u1->x ) );
u.y = CF2_CS_SCALE( SUB_INT32( u2->y, u1->y ) );
v.x = CF2_CS_SCALE( SUB_INT32( v2->x, v1->x ) );
v.y = CF2_CS_SCALE( SUB_INT32( v2->y, v1->y ) );
w.x = CF2_CS_SCALE( SUB_INT32( v1->x, u1->x ) );
w.y = CF2_CS_SCALE( SUB_INT32( v1->y, u1->y ) );
denominator = cf2_perp( u, v );
@ -1183,12 +1178,10 @@
s = FT_DivFix( cf2_perp( w, v ), denominator );
intersection->x = OVERFLOW_ADD_INT32(
u1->x,
FT_MulFix( s, OVERFLOW_SUB_INT32( u2->x, u1->x ) ) );
intersection->y = OVERFLOW_ADD_INT32(
u1->y,
FT_MulFix( s, OVERFLOW_SUB_INT32( u2->y, u1->y ) ) );
intersection->x = ADD_INT32( u1->x,
FT_MulFix( s, SUB_INT32( u2->x, u1->x ) ) );
intersection->y = ADD_INT32( u1->y,
FT_MulFix( s, SUB_INT32( u2->y, u1->y ) ) );
/*
@ -1200,35 +1193,29 @@
*
*/
if ( u1->x == u2->x &&
cf2_fixedAbs( OVERFLOW_SUB_INT32(
intersection->x,
u1->x ) ) < glyphpath->snapThreshold )
if ( u1->x == u2->x &&
cf2_fixedAbs( SUB_INT32( intersection->x,
u1->x ) ) < glyphpath->snapThreshold )
intersection->x = u1->x;
if ( u1->y == u2->y &&
cf2_fixedAbs( OVERFLOW_SUB_INT32(
intersection->y,
u1->y ) ) < glyphpath->snapThreshold )
if ( u1->y == u2->y &&
cf2_fixedAbs( SUB_INT32( intersection->y,
u1->y ) ) < glyphpath->snapThreshold )
intersection->y = u1->y;
if ( v1->x == v2->x &&
cf2_fixedAbs( OVERFLOW_SUB_INT32(
intersection->x,
v1->x ) ) < glyphpath->snapThreshold )
if ( v1->x == v2->x &&
cf2_fixedAbs( SUB_INT32( intersection->x,
v1->x ) ) < glyphpath->snapThreshold )
intersection->x = v1->x;
if ( v1->y == v2->y &&
cf2_fixedAbs( OVERFLOW_SUB_INT32(
intersection->y,
v1->y ) ) < glyphpath->snapThreshold )
if ( v1->y == v2->y &&
cf2_fixedAbs( SUB_INT32( intersection->y,
v1->y ) ) < glyphpath->snapThreshold )
intersection->y = v1->y;
/* limit the intersection distance from midpoint of u2 and v1 */
if ( cf2_fixedAbs( intersection->x -
OVERFLOW_ADD_INT32( u2->x, v1->x ) / 2 ) >
glyphpath->miterLimit ||
cf2_fixedAbs( intersection->y -
OVERFLOW_ADD_INT32( u2->y, v1->y ) / 2 ) >
glyphpath->miterLimit )
if ( cf2_fixedAbs( intersection->x - ADD_INT32( u2->x, v1->x ) / 2 ) >
glyphpath->miterLimit ||
cf2_fixedAbs( intersection->y - ADD_INT32( u2->y, v1->y ) / 2 ) >
glyphpath->miterLimit )
return FALSE;
return TRUE;
@ -1476,8 +1463,8 @@
CF2_Fixed* x,
CF2_Fixed* y )
{
CF2_Fixed dx = OVERFLOW_SUB_INT32( x2, x1 );
CF2_Fixed dy = OVERFLOW_SUB_INT32( y2, y1 );
CF2_Fixed dx = SUB_INT32( x2, x1 );
CF2_Fixed dy = SUB_INT32( y2, y1 );
/* note: negative offsets don't work here; negate deltas to change */
@ -1504,13 +1491,13 @@
{
/* first quadrant, +x +y */
if ( dx > OVERFLOW_MUL_INT32( 2, dy ) )
if ( dx > MUL_INT32( 2, dy ) )
{
/* +x */
*x = 0;
*y = 0;
}
else if ( dy > OVERFLOW_MUL_INT32( 2, dx ) )
else if ( dy > MUL_INT32( 2, dx ) )
{
/* +y */
*x = glyphpath->xOffset;
@ -1529,13 +1516,13 @@
{
/* fourth quadrant, +x -y */
if ( dx > OVERFLOW_MUL_INT32( -2, dy ) )
if ( dx > MUL_INT32( -2, dy ) )
{
/* +x */
*x = 0;
*y = 0;
}
else if ( NEG_INT32( dy ) > OVERFLOW_MUL_INT32( 2, dx ) )
else if ( NEG_INT32( dy ) > MUL_INT32( 2, dx ) )
{
/* -y */
*x = NEG_INT32( glyphpath->xOffset );
@ -1557,13 +1544,13 @@
{
/* second quadrant, -x +y */
if ( NEG_INT32( dx ) > OVERFLOW_MUL_INT32( 2, dy ) )
if ( NEG_INT32( dx ) > MUL_INT32( 2, dy ) )
{
/* -x */
*x = 0;
*y = OVERFLOW_MUL_INT32( 2, glyphpath->yOffset );
*y = MUL_INT32( 2, glyphpath->yOffset );
}
else if ( dy > OVERFLOW_MUL_INT32( -2, dx ) )
else if ( dy > MUL_INT32( -2, dx ) )
{
/* +y */
*x = glyphpath->xOffset;
@ -1582,13 +1569,13 @@
{
/* third quadrant, -x -y */
if ( NEG_INT32( dx ) > OVERFLOW_MUL_INT32( -2, dy ) )
if ( NEG_INT32( dx ) > MUL_INT32( -2, dy ) )
{
/* -x */
*x = 0;
*y = OVERFLOW_MUL_INT32( 2, glyphpath->yOffset );
*y = MUL_INT32( 2, glyphpath->yOffset );
}
else if ( NEG_INT32( dy ) > OVERFLOW_MUL_INT32( -2, dx ) )
else if ( NEG_INT32( dy ) > MUL_INT32( -2, dx ) )
{
/* -y */
*x = NEG_INT32( glyphpath->xOffset );
@ -1705,10 +1692,10 @@
&yOffset );
/* construct offset points */
P0.x = OVERFLOW_ADD_INT32( glyphpath->currentCS.x, xOffset );
P0.y = OVERFLOW_ADD_INT32( glyphpath->currentCS.y, yOffset );
P1.x = OVERFLOW_ADD_INT32( x, xOffset );
P1.y = OVERFLOW_ADD_INT32( y, yOffset );
P0.x = ADD_INT32( glyphpath->currentCS.x, xOffset );
P0.y = ADD_INT32( glyphpath->currentCS.y, yOffset );
P1.x = ADD_INT32( x, xOffset );
P1.y = ADD_INT32( y, yOffset );
if ( glyphpath->moveIsPending )
{
@ -1787,15 +1774,15 @@
cf2_getWindingMomentum( x1, y1, x2, y2 );
/* construct offset points */
P0.x = OVERFLOW_ADD_INT32( glyphpath->currentCS.x, xOffset1 );
P0.y = OVERFLOW_ADD_INT32( glyphpath->currentCS.y, yOffset1 );
P1.x = OVERFLOW_ADD_INT32( x1, xOffset1 );
P1.y = OVERFLOW_ADD_INT32( y1, yOffset1 );
P0.x = ADD_INT32( glyphpath->currentCS.x, xOffset1 );
P0.y = ADD_INT32( glyphpath->currentCS.y, yOffset1 );
P1.x = ADD_INT32( x1, xOffset1 );
P1.y = ADD_INT32( y1, yOffset1 );
/* note: preserve angle of final segment by using offset3 at both ends */
P2.x = OVERFLOW_ADD_INT32( x2, xOffset3 );
P2.y = OVERFLOW_ADD_INT32( y2, yOffset3 );
P3.x = OVERFLOW_ADD_INT32( x3, xOffset3 );
P3.y = OVERFLOW_ADD_INT32( y3, yOffset3 );
P2.x = ADD_INT32( x2, xOffset3 );
P2.y = ADD_INT32( y2, yOffset3 );
P3.x = ADD_INT32( x3, xOffset3 );
P3.y = ADD_INT32( y3, yOffset3 );
if ( glyphpath->moveIsPending )
{

View File

@ -305,11 +305,11 @@
stemhint.min =
position = OVERFLOW_ADD_INT32( position,
cf2_stack_getReal( opStack, i ) );
position = ADD_INT32( position,
cf2_stack_getReal( opStack, i ) );
stemhint.max =
position = OVERFLOW_ADD_INT32( position,
cf2_stack_getReal( opStack, i + 1 ) );
position = ADD_INT32( position,
cf2_stack_getReal( opStack, i + 1 ) );
stemhint.used = FALSE;
stemhint.maxDS =
@ -350,9 +350,8 @@
{
vals[i + 2] = vals[i];
if ( readFromStack[i] )
vals[i + 2] = OVERFLOW_ADD_INT32( vals[i + 2],
cf2_stack_getReal( opStack,
idx++ ) );
vals[i + 2] = ADD_INT32( vals[i + 2], cf2_stack_getReal( opStack,
idx++ ) );
}
if ( isHFlex )
@ -361,35 +360,33 @@
if ( doConditionalLastRead )
{
FT_Bool lastIsX = (FT_Bool)(
cf2_fixedAbs( OVERFLOW_SUB_INT32( vals[10],
*curX ) ) >
cf2_fixedAbs( OVERFLOW_SUB_INT32( vals[11],
*curY ) ) );
cf2_fixedAbs( SUB_INT32( vals[10], *curX ) ) >
cf2_fixedAbs( SUB_INT32( vals[11], *curY ) ) );
CF2_Fixed lastVal = cf2_stack_getReal( opStack, idx );
if ( lastIsX )
{
vals[12] = OVERFLOW_ADD_INT32( vals[10], lastVal );
vals[12] = ADD_INT32( vals[10], lastVal );
vals[13] = *curY;
}
else
{
vals[12] = *curX;
vals[13] = OVERFLOW_ADD_INT32( vals[11], lastVal );
vals[13] = ADD_INT32( vals[11], lastVal );
}
}
else
{
if ( readFromStack[10] )
vals[12] = OVERFLOW_ADD_INT32( vals[10],
cf2_stack_getReal( opStack, idx++ ) );
vals[12] = ADD_INT32( vals[10],
cf2_stack_getReal( opStack, idx++ ) );
else
vals[12] = *curX;
if ( readFromStack[11] )
vals[13] = OVERFLOW_ADD_INT32( vals[11],
cf2_stack_getReal( opStack, idx ) );
vals[13] = ADD_INT32( vals[11],
cf2_stack_getReal( opStack, idx ) );
else
vals[13] = *curY;
}
@ -435,10 +432,10 @@
for ( j = 1; j < blend->lenBV; j++ )
sum = OVERFLOW_ADD_INT32(
sum,
FT_MulFix( *weight++,
cf2_stack_getReal( opStack, delta++ ) ) );
sum = ADD_INT32( sum,
FT_MulFix( *weight++,
cf2_stack_getReal( opStack,
delta++ ) ) );
/* store blended result */
cf2_stack_setReal( opStack, i + base, sum );
@ -779,7 +776,7 @@
if ( font->decoder->width_only )
goto exit;
curY = OVERFLOW_ADD_INT32( curY, cf2_stack_popFixed( opStack ) );
curY = ADD_INT32( curY, cf2_stack_popFixed( opStack ) );
cf2_glyphpath_moveTo( &glyphPath, curX, curY );
@ -795,12 +792,10 @@
for ( idx = 0; idx < count; idx += 2 )
{
curX = OVERFLOW_ADD_INT32( curX,
cf2_stack_getReal( opStack,
idx + 0 ) );
curY = OVERFLOW_ADD_INT32( curY,
cf2_stack_getReal( opStack,
idx + 1 ) );
curX = ADD_INT32( curX, cf2_stack_getReal( opStack,
idx + 0 ) );
curY = ADD_INT32( curY, cf2_stack_getReal( opStack,
idx + 1 ) );
cf2_glyphpath_lineTo( &glyphPath, curX, curY );
}
@ -826,9 +821,9 @@
if ( isX )
curX = OVERFLOW_ADD_INT32( curX, v );
curX = ADD_INT32( curX, v );
else
curY = OVERFLOW_ADD_INT32( curY, v );
curY = ADD_INT32( curY, v );
isX = !isX;
@ -854,18 +849,12 @@
CF2_Fixed x1, y1, x2, y2, x3, y3;
x1 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, idx + 0 ),
curX );
y1 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, idx + 1 ),
curY );
x2 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, idx + 2 ),
x1 );
y2 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, idx + 3 ),
y1 );
x3 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, idx + 4 ),
x2 );
y3 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, idx + 5 ),
y2 );
x1 = ADD_INT32( cf2_stack_getReal( opStack, idx + 0 ), curX );
y1 = ADD_INT32( cf2_stack_getReal( opStack, idx + 1 ), curY );
x2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 2 ), x1 );
y2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 3 ), y1 );
x3 = ADD_INT32( cf2_stack_getReal( opStack, idx + 4 ), x2 );
y3 = ADD_INT32( cf2_stack_getReal( opStack, idx + 5 ), y2 );
cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 );
@ -876,12 +865,10 @@
if ( op1 == cf2_cmdRCURVELINE )
{
curX = OVERFLOW_ADD_INT32( curX,
cf2_stack_getReal( opStack,
idx + 0 ) );
curY = OVERFLOW_ADD_INT32( curY,
cf2_stack_getReal( opStack,
idx + 1 ) );
curX = ADD_INT32( curX, cf2_stack_getReal( opStack,
idx + 0 ) );
curY = ADD_INT32( curY, cf2_stack_getReal( opStack,
idx + 1 ) );
cf2_glyphpath_lineTo( &glyphPath, curX, curY );
}
@ -1176,8 +1163,8 @@
summand1 = cf2_stack_popFixed( opStack );
cf2_stack_pushFixed( opStack,
OVERFLOW_ADD_INT32( summand1,
summand2 ) );
ADD_INT32( summand1,
summand2 ) );
}
continue; /* do not clear the stack */
@ -1193,8 +1180,7 @@
minuend = cf2_stack_popFixed( opStack );
cf2_stack_pushFixed( opStack,
OVERFLOW_SUB_INT32( minuend,
subtrahend ) );
SUB_INT32( minuend, subtrahend ) );
}
continue; /* do not clear the stack */
@ -1461,8 +1447,8 @@
cf2_stack_count( opStack ) == 5 )
{
if ( !haveWidth )
*width = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, 0 ),
nominalWidthX );
*width = ADD_INT32( cf2_stack_getReal( opStack, 0 ),
nominalWidthX );
}
/* width is defined or default after this */
@ -1610,8 +1596,8 @@
FT_TRACE4(( " rmoveto\n" ));
if ( cf2_stack_count( opStack ) > 2 && !haveWidth )
*width = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, 0 ),
nominalWidthX );
*width = ADD_INT32( cf2_stack_getReal( opStack, 0 ),
nominalWidthX );
/* width is defined or default after this */
haveWidth = TRUE;
@ -1619,8 +1605,8 @@
if ( font->decoder->width_only )
goto exit;
curY = OVERFLOW_ADD_INT32( curY, cf2_stack_popFixed( opStack ) );
curX = OVERFLOW_ADD_INT32( curX, cf2_stack_popFixed( opStack ) );
curY = ADD_INT32( curY, cf2_stack_popFixed( opStack ) );
curX = ADD_INT32( curX, cf2_stack_popFixed( opStack ) );
cf2_glyphpath_moveTo( &glyphPath, curX, curY );
@ -1630,8 +1616,8 @@
FT_TRACE4(( " hmoveto\n" ));
if ( cf2_stack_count( opStack ) > 1 && !haveWidth )
*width = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, 0 ),
nominalWidthX );
*width = ADD_INT32( cf2_stack_getReal( opStack, 0 ),
nominalWidthX );
/* width is defined or default after this */
haveWidth = TRUE;
@ -1639,7 +1625,7 @@
if ( font->decoder->width_only )
goto exit;
curX = OVERFLOW_ADD_INT32( curX, cf2_stack_popFixed( opStack ) );
curX = ADD_INT32( curX, cf2_stack_popFixed( opStack ) );
cf2_glyphpath_moveTo( &glyphPath, curX, curY );
@ -1655,12 +1641,10 @@
while ( idx + 6 < count )
{
curX = OVERFLOW_ADD_INT32( curX,
cf2_stack_getReal( opStack,
idx + 0 ) );
curY = OVERFLOW_ADD_INT32( curY,
cf2_stack_getReal( opStack,
idx + 1 ) );
curX = ADD_INT32( curX, cf2_stack_getReal( opStack,
idx + 0 ) );
curY = ADD_INT32( curY, cf2_stack_getReal( opStack,
idx + 1 ) );
cf2_glyphpath_lineTo( &glyphPath, curX, curY );
idx += 2;
@ -1671,24 +1655,12 @@
CF2_Fixed x1, y1, x2, y2, x3, y3;
x1 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack,
idx + 0 ),
curX );
y1 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack,
idx + 1 ),
curY );
x2 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack,
idx + 2 ),
x1 );
y2 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack,
idx + 3 ),
y1 );
x3 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack,
idx + 4 ),
x2 );
y3 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack,
idx + 5 ),
y2 );
x1 = ADD_INT32( cf2_stack_getReal( opStack, idx + 0 ), curX );
y1 = ADD_INT32( cf2_stack_getReal( opStack, idx + 1 ), curY );
x2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 2 ), x1 );
y2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 3 ), y1 );
x3 = ADD_INT32( cf2_stack_getReal( opStack, idx + 4 ), x2 );
y3 = ADD_INT32( cf2_stack_getReal( opStack, idx + 5 ), y2 );
cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 );
@ -1722,23 +1694,18 @@
if ( ( count - idx ) & 1 )
{
x1 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, idx ),
curX );
x1 = ADD_INT32( cf2_stack_getReal( opStack, idx ), curX );
idx++;
}
else
x1 = curX;
y1 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, idx + 0 ),
curY );
x2 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, idx + 1 ),
x1 );
y2 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, idx + 2 ),
y1 );
y1 = ADD_INT32( cf2_stack_getReal( opStack, idx + 0 ), curY );
x2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 1 ), x1 );
y2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 2 ), y1 );
x3 = x2;
y3 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, idx + 3 ),
y2 );
y3 = ADD_INT32( cf2_stack_getReal( opStack, idx + 3 ), y2 );
cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 );
@ -1772,22 +1739,17 @@
if ( ( count - idx ) & 1 )
{
y1 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, idx ),
curY );
y1 = ADD_INT32( cf2_stack_getReal( opStack, idx ), curY );
idx++;
}
else
y1 = curY;
x1 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, idx + 0 ),
curX );
x2 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, idx + 1 ),
x1 );
y2 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, idx + 2 ),
y1 );
x3 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, idx + 3 ),
x2 );
x1 = ADD_INT32( cf2_stack_getReal( opStack, idx + 0 ), curX );
x2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 1 ), x1 );
y2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 2 ), y1 );
x3 = ADD_INT32( cf2_stack_getReal( opStack, idx + 3 ), x2 );
y3 = y2;
cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 );
@ -1826,21 +1788,15 @@
if ( alternate )
{
x1 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, idx + 0 ),
curX );
x1 = ADD_INT32( cf2_stack_getReal( opStack, idx + 0 ), curX );
y1 = curY;
x2 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, idx + 1 ),
x1 );
y2 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, idx + 2 ),
y1 );
y3 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, idx + 3 ),
y2 );
x2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 1 ), x1 );
y2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 2 ), y1 );
y3 = ADD_INT32( cf2_stack_getReal( opStack, idx + 3 ), y2 );
if ( count - idx == 5 )
{
x3 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack,
idx + 4 ),
x2 );
x3 = ADD_INT32( cf2_stack_getReal( opStack, idx + 4 ), x2 );
idx++;
}
@ -1852,20 +1808,14 @@
else
{
x1 = curX;
y1 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, idx + 0 ),
curY );
x2 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, idx + 1 ),
x1 );
y2 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, idx + 2 ),
y1 );
x3 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack, idx + 3 ),
x2 );
y1 = ADD_INT32( cf2_stack_getReal( opStack, idx + 0 ), curY );
x2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 1 ), x1 );
y2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 2 ), y1 );
x3 = ADD_INT32( cf2_stack_getReal( opStack, idx + 3 ), x2 );
if ( count - idx == 5 )
{
y3 = OVERFLOW_ADD_INT32( cf2_stack_getReal( opStack,
idx + 4 ),
y2 );
y3 = ADD_INT32( cf2_stack_getReal( opStack, idx + 4 ), y2 );
idx++;
}

View File

@ -1451,8 +1451,8 @@
cff_builder_close_contour( builder );
builder->path_begun = 0;
x = OVERFLOW_ADD_LONG( x, args[-2] );
y = OVERFLOW_ADD_LONG( y, args[-1] );
x = ADD_LONG( x, args[-2] );
y = ADD_LONG( y, args[-1] );
args = stack;
break;
@ -1461,7 +1461,7 @@
cff_builder_close_contour( builder );
builder->path_begun = 0;
y = OVERFLOW_ADD_LONG( y, args[-1] );
y = ADD_LONG( y, args[-1] );
args = stack;
break;
@ -1470,7 +1470,7 @@
cff_builder_close_contour( builder );
builder->path_begun = 0;
x = OVERFLOW_ADD_LONG( x, args[-1] );
x = ADD_LONG( x, args[-1] );
args = stack;
break;
@ -1487,8 +1487,8 @@
args -= num_args & ~1;
while ( args < decoder->top )
{
x = OVERFLOW_ADD_LONG( x, args[0] );
y = OVERFLOW_ADD_LONG( y, args[1] );
x = ADD_LONG( x, args[0] );
y = ADD_LONG( y, args[1] );
cff_builder_add_point( builder, x, y, 1 );
args += 2;
}
@ -1520,9 +1520,9 @@
while ( args < decoder->top )
{
if ( phase )
x = OVERFLOW_ADD_LONG( x, args[0] );
x = ADD_LONG( x, args[0] );
else
y = OVERFLOW_ADD_LONG( y, args[0] );
y = ADD_LONG( y, args[0] );
if ( cff_builder_add_point1( builder, x, y ) )
goto Fail;
@ -1553,16 +1553,16 @@
args -= nargs;
while ( args < decoder->top )
{
x = OVERFLOW_ADD_LONG( x, args[0] );
y = OVERFLOW_ADD_LONG( y, args[1] );
x = ADD_LONG( x, args[0] );
y = ADD_LONG( y, args[1] );
cff_builder_add_point( builder, x, y, 0 );
x = OVERFLOW_ADD_LONG( x, args[2] );
y = OVERFLOW_ADD_LONG( y, args[3] );
x = ADD_LONG( x, args[2] );
y = ADD_LONG( y, args[3] );
cff_builder_add_point( builder, x, y, 0 );
x = OVERFLOW_ADD_LONG( x, args[4] );
y = OVERFLOW_ADD_LONG( y, args[5] );
x = ADD_LONG( x, args[4] );
y = ADD_LONG( y, args[5] );
cff_builder_add_point( builder, x, y, 1 );
args += 6;
@ -1593,7 +1593,7 @@
if ( nargs & 1 )
{
x = OVERFLOW_ADD_LONG( x, args[0] );
x = ADD_LONG( x, args[0] );
args++;
nargs--;
}
@ -1603,14 +1603,14 @@
while ( args < decoder->top )
{
y = OVERFLOW_ADD_LONG( y, args[0] );
y = ADD_LONG( y, args[0] );
cff_builder_add_point( builder, x, y, 0 );
x = OVERFLOW_ADD_LONG( x, args[1] );
y = OVERFLOW_ADD_LONG( y, args[2] );
x = ADD_LONG( x, args[1] );
y = ADD_LONG( y, args[2] );
cff_builder_add_point( builder, x, y, 0 );
y = OVERFLOW_ADD_LONG( y, args[3] );
y = ADD_LONG( y, args[3] );
cff_builder_add_point( builder, x, y, 1 );
args += 4;
@ -1640,7 +1640,7 @@
args -= nargs;
if ( nargs & 1 )
{
y = OVERFLOW_ADD_LONG( y, args[0] );
y = ADD_LONG( y, args[0] );
args++;
nargs--;
}
@ -1650,14 +1650,14 @@
while ( args < decoder->top )
{
x = OVERFLOW_ADD_LONG( x, args[0] );
x = ADD_LONG( x, args[0] );
cff_builder_add_point( builder, x, y, 0 );
x = OVERFLOW_ADD_LONG( x, args[1] );
y = OVERFLOW_ADD_LONG( y, args[2] );
x = ADD_LONG( x, args[1] );
y = ADD_LONG( y, args[2] );
cff_builder_add_point( builder, x, y, 0 );
x = OVERFLOW_ADD_LONG( x, args[3] );
x = ADD_LONG( x, args[3] );
cff_builder_add_point( builder, x, y, 1 );
args += 4;
@ -1698,30 +1698,30 @@
nargs -= 4;
if ( phase )
{
x = OVERFLOW_ADD_LONG( x, args[0] );
x = ADD_LONG( x, args[0] );
cff_builder_add_point( builder, x, y, 0 );
x = OVERFLOW_ADD_LONG( x, args[1] );
y = OVERFLOW_ADD_LONG( y, args[2] );
x = ADD_LONG( x, args[1] );
y = ADD_LONG( y, args[2] );
cff_builder_add_point( builder, x, y, 0 );
y = OVERFLOW_ADD_LONG( y, args[3] );
y = ADD_LONG( y, args[3] );
if ( nargs == 1 )
x = OVERFLOW_ADD_LONG( x, args[4] );
x = ADD_LONG( x, args[4] );
cff_builder_add_point( builder, x, y, 1 );
}
else
{
y = OVERFLOW_ADD_LONG( y, args[0] );
y = ADD_LONG( y, args[0] );
cff_builder_add_point( builder, x, y, 0 );
x = OVERFLOW_ADD_LONG( x, args[1] );
y = OVERFLOW_ADD_LONG( y, args[2] );
x = ADD_LONG( x, args[1] );
y = ADD_LONG( y, args[2] );
cff_builder_add_point( builder, x, y, 0 );
x = OVERFLOW_ADD_LONG( x, args[3] );
x = ADD_LONG( x, args[3] );
if ( nargs == 1 )
y = OVERFLOW_ADD_LONG( y, args[4] );
y = ADD_LONG( y, args[4] );
cff_builder_add_point( builder, x, y, 1 );
}
args += 4;
@ -1754,8 +1754,8 @@
/* first, add the line segments */
while ( num_lines > 0 )
{
x = OVERFLOW_ADD_LONG( x, args[0] );
y = OVERFLOW_ADD_LONG( y, args[1] );
x = ADD_LONG( x, args[0] );
y = ADD_LONG( y, args[1] );
cff_builder_add_point( builder, x, y, 1 );
args += 2;
@ -1763,16 +1763,16 @@
}
/* then the curve */
x = OVERFLOW_ADD_LONG( x, args[0] );
y = OVERFLOW_ADD_LONG( y, args[1] );
x = ADD_LONG( x, args[0] );
y = ADD_LONG( y, args[1] );
cff_builder_add_point( builder, x, y, 0 );
x = OVERFLOW_ADD_LONG( x, args[2] );
y = OVERFLOW_ADD_LONG( y, args[3] );
x = ADD_LONG( x, args[2] );
y = ADD_LONG( y, args[3] );
cff_builder_add_point( builder, x, y, 0 );
x = OVERFLOW_ADD_LONG( x, args[4] );
y = OVERFLOW_ADD_LONG( y, args[5] );
x = ADD_LONG( x, args[4] );
y = ADD_LONG( y, args[5] );
cff_builder_add_point( builder, x, y, 1 );
args = stack;
@ -1803,16 +1803,16 @@
/* first, add the curves */
while ( num_curves > 0 )
{
x = OVERFLOW_ADD_LONG( x, args[0] );
y = OVERFLOW_ADD_LONG( y, args[1] );
x = ADD_LONG( x, args[0] );
y = ADD_LONG( y, args[1] );
cff_builder_add_point( builder, x, y, 0 );
x = OVERFLOW_ADD_LONG( x, args[2] );
y = OVERFLOW_ADD_LONG( y, args[3] );
x = ADD_LONG( x, args[2] );
y = ADD_LONG( y, args[3] );
cff_builder_add_point( builder, x, y, 0 );
x = OVERFLOW_ADD_LONG( x, args[4] );
y = OVERFLOW_ADD_LONG( y, args[5] );
x = ADD_LONG( x, args[4] );
y = ADD_LONG( y, args[5] );
cff_builder_add_point( builder, x, y, 1 );
args += 6;
@ -1820,8 +1820,8 @@
}
/* then the final line */
x = OVERFLOW_ADD_LONG( x, args[0] );
y = OVERFLOW_ADD_LONG( y, args[1] );
x = ADD_LONG( x, args[0] );
y = ADD_LONG( y, args[1] );
cff_builder_add_point( builder, x, y, 1 );
args = stack;
@ -1846,32 +1846,32 @@
start_y = y;
/* first control point */
x = OVERFLOW_ADD_LONG( x, args[0] );
y = OVERFLOW_ADD_LONG( y, args[1] );
x = ADD_LONG( x, args[0] );
y = ADD_LONG( y, args[1] );
cff_builder_add_point( builder, x, y, 0 );
/* second control point */
x = OVERFLOW_ADD_LONG( x, args[2] );
y = OVERFLOW_ADD_LONG( y, args[3] );
x = ADD_LONG( x, args[2] );
y = ADD_LONG( y, args[3] );
cff_builder_add_point( builder, x, y, 0 );
/* join point; on curve, with y-value the same as the last */
/* control point's y-value */
x = OVERFLOW_ADD_LONG( x, args[4] );
x = ADD_LONG( x, args[4] );
cff_builder_add_point( builder, x, y, 1 );
/* third control point, with y-value the same as the join */
/* point's y-value */
x = OVERFLOW_ADD_LONG( x, args[5] );
x = ADD_LONG( x, args[5] );
cff_builder_add_point( builder, x, y, 0 );
/* fourth control point */
x = OVERFLOW_ADD_LONG( x, args[6] );
y = OVERFLOW_ADD_LONG( y, args[7] );
x = ADD_LONG( x, args[6] );
y = ADD_LONG( y, args[7] );
cff_builder_add_point( builder, x, y, 0 );
/* ending point, with y-value the same as the start */
x = OVERFLOW_ADD_LONG( x, args[8] );
x = ADD_LONG( x, args[8] );
y = start_y;
cff_builder_add_point( builder, x, y, 1 );
@ -1895,32 +1895,32 @@
start_y = y;
/* first control point */
x = OVERFLOW_ADD_LONG( x, args[0] );
x = ADD_LONG( x, args[0] );
cff_builder_add_point( builder, x, y, 0 );
/* second control point */
x = OVERFLOW_ADD_LONG( x, args[1] );
y = OVERFLOW_ADD_LONG( y, args[2] );
x = ADD_LONG( x, args[1] );
y = ADD_LONG( y, args[2] );
cff_builder_add_point( builder, x, y, 0 );
/* join point; on curve, with y-value the same as the last */
/* control point's y-value */
x = OVERFLOW_ADD_LONG( x, args[3] );
x = ADD_LONG( x, args[3] );
cff_builder_add_point( builder, x, y, 1 );
/* third control point, with y-value the same as the join */
/* point's y-value */
x = OVERFLOW_ADD_LONG( x, args[4] );
x = ADD_LONG( x, args[4] );
cff_builder_add_point( builder, x, y, 0 );
/* fourth control point */
x = OVERFLOW_ADD_LONG( x, args[5] );
x = ADD_LONG( x, args[5] );
y = start_y;
cff_builder_add_point( builder, x, y, 0 );
/* ending point, with y-value the same as the start point's */
/* y-value -- we don't add this point, though */
x = OVERFLOW_ADD_LONG( x, args[6] );
x = ADD_LONG( x, args[6] );
cff_builder_add_point( builder, x, y, 1 );
args = stack;
@ -1956,8 +1956,8 @@
/* grab up to the last argument */
for ( count = 5; count > 0; count-- )
{
dx = OVERFLOW_ADD_LONG( dx, temp[0] );
dy = OVERFLOW_ADD_LONG( dy, temp[1] );
dx = ADD_LONG( dx, temp[0] );
dy = ADD_LONG( dy, temp[1] );
temp += 2;
}
@ -1971,8 +1971,8 @@
for ( count = 5; count > 0; count-- )
{
x = OVERFLOW_ADD_LONG( x, args[0] );
y = OVERFLOW_ADD_LONG( y, args[1] );
x = ADD_LONG( x, args[0] );
y = ADD_LONG( y, args[1] );
cff_builder_add_point( builder, x, y,
(FT_Bool)( count == 3 ) );
args += 2;
@ -1981,13 +1981,13 @@
/* is last operand an x- or y-delta? */
if ( horizontal )
{
x = OVERFLOW_ADD_LONG( x, args[0] );
x = ADD_LONG( x, args[0] );
y = start_y;
}
else
{
x = start_x;
y = OVERFLOW_ADD_LONG( y, args[0] );
y = ADD_LONG( y, args[0] );
}
cff_builder_add_point( builder, x, y, 1 );
@ -2009,8 +2009,8 @@
for ( count = 6; count > 0; count-- )
{
x = OVERFLOW_ADD_LONG( x, args[0] );
y = OVERFLOW_ADD_LONG( y, args[1] );
x = ADD_LONG( x, args[0] );
y = ADD_LONG( y, args[1] );
cff_builder_add_point( builder, x, y,
(FT_Bool)( count == 4 || count == 1 ) );
args += 2;
@ -2100,14 +2100,14 @@
case cff_op_add:
FT_TRACE4(( " add\n" ));
args[0] = OVERFLOW_ADD_LONG( args[0], args[1] );
args[0] = ADD_LONG( args[0], args[1] );
args++;
break;
case cff_op_sub:
FT_TRACE4(( " sub\n" ));
args[0] = OVERFLOW_SUB_LONG( args[0], args[1] );
args[0] = SUB_LONG( args[0], args[1] );
args++;
break;
@ -2380,12 +2380,12 @@
FT_TRACE4(( " hsbw (invalid op)\n" ));
decoder->glyph_width =
OVERFLOW_ADD_LONG( decoder->nominal_width, ( args[1] >> 16 ) );
ADD_LONG( decoder->nominal_width, ( args[1] >> 16 ) );
decoder->builder.left_bearing.x = args[0];
decoder->builder.left_bearing.y = 0;
x = OVERFLOW_ADD_LONG( decoder->builder.pos_x, args[0] );
x = ADD_LONG( decoder->builder.pos_x, args[0] );
y = decoder->builder.pos_y;
args = stack;
break;
@ -2398,13 +2398,13 @@
FT_TRACE4(( " sbw (invalid op)\n" ));
decoder->glyph_width =
OVERFLOW_ADD_LONG( decoder->nominal_width, ( args[2] >> 16 ) );
ADD_LONG( decoder->nominal_width, ( args[2] >> 16 ) );
decoder->builder.left_bearing.x = args[0];
decoder->builder.left_bearing.y = args[1];
x = OVERFLOW_ADD_LONG( decoder->builder.pos_x, args[0] );
y = OVERFLOW_ADD_LONG( decoder->builder.pos_y, args[1] );
x = ADD_LONG( decoder->builder.pos_x, args[0] );
y = ADD_LONG( decoder->builder.pos_y, args[1] );
args = stack;
break;
@ -2415,8 +2415,8 @@
FT_TRACE4(( " setcurrentpoint (invalid op)\n" ));
x = OVERFLOW_ADD_LONG( decoder->builder.pos_x, args[0] );
y = OVERFLOW_ADD_LONG( decoder->builder.pos_y, args[1] );
x = ADD_LONG( decoder->builder.pos_x, args[0] );
y = ADD_LONG( decoder->builder.pos_y, args[1] );
args = stack;
break;

View File

@ -1352,7 +1352,7 @@
sum = cff_parse_num( parser, &parser->stack[i + base] ) * 65536;
for ( j = 1; j < blend->lenBV; j++ )
sum = OVERFLOW_ADD_INT32(
sum = ADD_INT32(
sum,
FT_MulFix(
*weight++,

View File

@ -1610,8 +1610,7 @@
val = 0;
while ( num_args > 0 )
{
val = OVERFLOW_ADD_LONG( val,
cff_parse_num( parser, data++ ) );
val = ADD_LONG( val, cff_parse_num( parser, data++ ) );
switch ( field->size )
{
case (8 / FT_CHAR_BIT):

View File

@ -864,9 +864,9 @@
for ( mm = 1; mm < blend->num_designs; mm++ )
tmp = OVERFLOW_ADD_LONG(
tmp,
FT_MulFix( *delta++, blend->weight_vector[mm] ) );
tmp = ADD_LONG( tmp,
FT_MulFix( *delta++,
blend->weight_vector[mm] ) );
*values++ = tmp;
}
@ -906,7 +906,7 @@
if ( arg_cnt != 2 )
goto Unexpected_OtherSubr;
top[0] = OVERFLOW_ADD_LONG( top[0], top[1] );
top[0] = ADD_LONG( top[0], top[1] );
known_othersubr_result_cnt = 1;
break;
@ -917,7 +917,7 @@
if ( arg_cnt != 2 )
goto Unexpected_OtherSubr;
top[0] = OVERFLOW_SUB_LONG( top[0], top[1] );
top[0] = SUB_LONG( top[0], top[1] );
known_othersubr_result_cnt = 1;
break;
@ -1149,13 +1149,13 @@
builder->parse_state = T1_Parse_Have_Width;
builder->left_bearing.x = OVERFLOW_ADD_LONG(
builder->left_bearing.x, top[0] );
builder->left_bearing.x = ADD_LONG( builder->left_bearing.x,
top[0] );
builder->advance.x = top[1];
builder->advance.y = 0;
orig_x = x = OVERFLOW_ADD_LONG( builder->pos_x, top[0] );
orig_x = x = ADD_LONG( builder->pos_x, top[0] );
orig_y = y = builder->pos_y;
FT_UNUSED( orig_y );
@ -1181,16 +1181,16 @@
builder->parse_state = T1_Parse_Have_Width;
builder->left_bearing.x = OVERFLOW_ADD_LONG(
builder->left_bearing.x, top[0] );
builder->left_bearing.y = OVERFLOW_ADD_LONG(
builder->left_bearing.y, top[1] );
builder->left_bearing.x = ADD_LONG( builder->left_bearing.x,
top[0] );
builder->left_bearing.y = ADD_LONG( builder->left_bearing.y,
top[1] );
builder->advance.x = top[2];
builder->advance.y = top[3];
x = OVERFLOW_ADD_LONG( builder->pos_x, top[0] );
y = OVERFLOW_ADD_LONG( builder->pos_y, top[1] );
x = ADD_LONG( builder->pos_x, top[0] );
y = ADD_LONG( builder->pos_y, top[1] );
/* the `metrics_only' indicates that we only want to compute */
/* the glyph's metrics (lsb + advance width), not load the */
@ -1217,13 +1217,13 @@
if ( FT_SET_ERROR( t1_builder_start_point( builder, x, y ) ) )
goto Fail;
x = OVERFLOW_ADD_LONG( x, top[0] );
x = ADD_LONG( x, top[0] );
goto Add_Line;
case op_hmoveto:
FT_TRACE4(( " hmoveto" ));
x = OVERFLOW_ADD_LONG( x, top[0] );
x = ADD_LONG( x, top[0] );
if ( !decoder->flex_state )
{
@ -1240,14 +1240,14 @@
FT_SET_ERROR( t1_builder_check_points( builder, 3 ) ) )
goto Fail;
x = OVERFLOW_ADD_LONG( x, top[0] );
x = ADD_LONG( x, top[0] );
t1_builder_add_point( builder, x, y, 0 );
x = OVERFLOW_ADD_LONG( x, top[1] );
y = OVERFLOW_ADD_LONG( y, top[2] );
x = ADD_LONG( x, top[1] );
y = ADD_LONG( y, top[2] );
t1_builder_add_point( builder, x, y, 0 );
y = OVERFLOW_ADD_LONG( y, top[3] );
y = ADD_LONG( y, top[3] );
t1_builder_add_point( builder, x, y, 1 );
break;
@ -1257,8 +1257,8 @@
if ( FT_SET_ERROR( t1_builder_start_point( builder, x, y ) ) )
goto Fail;
x = OVERFLOW_ADD_LONG( x, top[0] );
y = OVERFLOW_ADD_LONG( y, top[1] );
x = ADD_LONG( x, top[0] );
y = ADD_LONG( y, top[1] );
Add_Line:
if ( FT_SET_ERROR( t1_builder_add_point1( builder, x, y ) ) )
@ -1268,8 +1268,8 @@
case op_rmoveto:
FT_TRACE4(( " rmoveto" ));
x = OVERFLOW_ADD_LONG( x, top[0] );
y = OVERFLOW_ADD_LONG( y, top[1] );
x = ADD_LONG( x, top[0] );
y = ADD_LONG( y, top[1] );
if ( !decoder->flex_state )
{
@ -1286,16 +1286,16 @@
FT_SET_ERROR( t1_builder_check_points( builder, 3 ) ) )
goto Fail;
x = OVERFLOW_ADD_LONG( x, top[0] );
y = OVERFLOW_ADD_LONG( y, top[1] );
x = ADD_LONG( x, top[0] );
y = ADD_LONG( y, top[1] );
t1_builder_add_point( builder, x, y, 0 );
x = OVERFLOW_ADD_LONG( x, top[2] );
y = OVERFLOW_ADD_LONG( y, top[3] );
x = ADD_LONG( x, top[2] );
y = ADD_LONG( y, top[3] );
t1_builder_add_point( builder, x, y, 0 );
x = OVERFLOW_ADD_LONG( x, top[4] );
y = OVERFLOW_ADD_LONG( y, top[5] );
x = ADD_LONG( x, top[4] );
y = ADD_LONG( y, top[5] );
t1_builder_add_point( builder, x, y, 1 );
break;
@ -1306,14 +1306,14 @@
FT_SET_ERROR( t1_builder_check_points( builder, 3 ) ) )
goto Fail;
y = OVERFLOW_ADD_LONG( y, top[0] );
y = ADD_LONG( y, top[0] );
t1_builder_add_point( builder, x, y, 0 );
x = OVERFLOW_ADD_LONG( x, top[1] );
y = OVERFLOW_ADD_LONG( y, top[2] );
x = ADD_LONG( x, top[1] );
y = ADD_LONG( y, top[2] );
t1_builder_add_point( builder, x, y, 0 );
x = OVERFLOW_ADD_LONG( x, top[3] );
x = ADD_LONG( x, top[3] );
t1_builder_add_point( builder, x, y, 1 );
break;
@ -1323,13 +1323,13 @@
if ( FT_SET_ERROR( t1_builder_start_point( builder, x, y ) ) )
goto Fail;
y = OVERFLOW_ADD_LONG( y, top[0] );
y = ADD_LONG( y, top[0] );
goto Add_Line;
case op_vmoveto:
FT_TRACE4(( " vmoveto" ));
y = OVERFLOW_ADD_LONG( y, top[0] );
y = ADD_LONG( y, top[0] );
if ( !decoder->flex_state )
{
@ -1487,7 +1487,7 @@
/* record vertical hint */
if ( hinter )
{
top[0] = OVERFLOW_ADD_LONG( top[0], orig_x );
top[0] = ADD_LONG( top[0], orig_x );
hinter->stem( hinter->hints, 0, top );
}
break;
@ -1501,9 +1501,9 @@
FT_Pos dx = orig_x;
top[0] = OVERFLOW_ADD_LONG( top[0], dx );
top[2] = OVERFLOW_ADD_LONG( top[2], dx );
top[4] = OVERFLOW_ADD_LONG( top[4], dx );
top[0] = ADD_LONG( top[0], dx );
top[2] = ADD_LONG( top[2], dx );
top[4] = ADD_LONG( top[4], dx );
hinter->stem3( hinter->hints, 0, top );
}
break;

View File

@ -141,11 +141,11 @@
#define FT_INT_MAX INT_MAX
#define FT_ULONG_MAX ULONG_MAX
#define OVERFLOW_ADD_LONG( a, b ) \
#define ADD_LONG( a, b ) \
(long)( (unsigned long)(a) + (unsigned long)(b) )
#define OVERFLOW_SUB_LONG( a, b ) \
#define SUB_LONG( a, b ) \
(long)( (unsigned long)(a) - (unsigned long)(b) )
#define OVERFLOW_MUL_LONG( a, b ) \
#define MUL_LONG( a, b ) \
(long)( (unsigned long)(a) * (unsigned long)(b) )
#define NEG_LONG( a ) \
(long)( -(unsigned long)(a) )
@ -1146,8 +1146,7 @@ typedef ptrdiff_t FT_PtrDist;
/* s is L * the perpendicular distance from P1 to the line P0-P3. */
dx1 = arc[1].x - arc[0].x;
dy1 = arc[1].y - arc[0].y;
s = FT_ABS( OVERFLOW_SUB_LONG( OVERFLOW_MUL_LONG( dy, dx1 ),
OVERFLOW_MUL_LONG( dx, dy1 ) ) );
s = FT_ABS( SUB_LONG( MUL_LONG( dy, dx1 ), MUL_LONG( dx, dy1 ) ) );
if ( s > s_limit )
goto Split;
@ -1155,8 +1154,7 @@ typedef ptrdiff_t FT_PtrDist;
/* s is L * the perpendicular distance from P2 to the line P0-P3. */
dx2 = arc[2].x - arc[0].x;
dy2 = arc[2].y - arc[0].y;
s = FT_ABS( OVERFLOW_SUB_LONG( OVERFLOW_MUL_LONG( dy, dx2 ),
OVERFLOW_MUL_LONG( dx, dy2 ) ) );
s = FT_ABS( SUB_LONG( MUL_LONG( dy, dx2 ), MUL_LONG( dx, dy2 ) ) );
if ( s > s_limit )
goto Split;

View File

@ -2100,8 +2100,8 @@
}
/* set glyph dimensions */
glyph->metrics.width = OVERFLOW_SUB_LONG( bbox.xMax, bbox.xMin );
glyph->metrics.height = OVERFLOW_SUB_LONG( bbox.yMax, bbox.yMin );
glyph->metrics.width = SUB_LONG( bbox.xMax, bbox.xMin );
glyph->metrics.height = SUB_LONG( bbox.yMax, bbox.yMin );
/* Now take care of vertical metrics. In the case where there is */
/* no vertical information within the font (relatively common), */
@ -2137,8 +2137,8 @@
/* table in the font. Otherwise, we use the */
/* values defined in the horizontal header. */
height = (FT_Short)FT_DivFix( OVERFLOW_SUB_LONG( bbox.yMax,
bbox.yMin ),
height = (FT_Short)FT_DivFix( SUB_LONG( bbox.yMax,
bbox.yMin ),
y_scale );
if ( face->os2.version != 0xFFFFU )
advance = (FT_Pos)( face->os2.sTypoAscender -

View File

@ -65,15 +65,15 @@
TT_INTERPRETER_VERSION_40 )
#endif
#define PROJECT( v1, v2 ) \
exc->func_project( exc, \
OVERFLOW_SUB_LONG( (v1)->x, (v2)->x ), \
OVERFLOW_SUB_LONG( (v1)->y, (v2)->y ) )
#define PROJECT( v1, v2 ) \
exc->func_project( exc, \
SUB_LONG( (v1)->x, (v2)->x ), \
SUB_LONG( (v1)->y, (v2)->y ) )
#define DUALPROJ( v1, v2 ) \
exc->func_dualproj( exc, \
OVERFLOW_SUB_LONG( (v1)->x, (v2)->x ), \
OVERFLOW_SUB_LONG( (v1)->y, (v2)->y ) )
#define DUALPROJ( v1, v2 ) \
exc->func_dualproj( exc, \
SUB_LONG( (v1)->x, (v2)->x ), \
SUB_LONG( (v1)->y, (v2)->y ) )
#define FAST_PROJECT( v ) \
exc->func_project( exc, (v)->x, (v)->y )
@ -1680,9 +1680,10 @@
if ( SUBPIXEL_HINTING_INFINALITY &&
( !exc->ignore_x_mode ||
( exc->sph_tweak_flags & SPH_TWEAK_ALLOW_X_DMOVE ) ) )
zone->cur[point].x = OVERFLOW_ADD_LONG(
zone->cur[point].x,
FT_MulDiv( distance, v, exc->F_dot_P ) );
zone->cur[point].x = ADD_LONG( zone->cur[point].x,
FT_MulDiv( distance,
v,
exc->F_dot_P ) );
else
#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
@ -1691,16 +1692,18 @@
/* diagonal moves, but only post-IUP. DejaVu tries to adjust */
/* diagonal stems like on `Z' and `z' post-IUP. */
if ( SUBPIXEL_HINTING_MINIMAL && !exc->backward_compatibility )
zone->cur[point].x = OVERFLOW_ADD_LONG(
zone->cur[point].x,
FT_MulDiv( distance, v, exc->F_dot_P ) );
zone->cur[point].x = ADD_LONG( zone->cur[point].x,
FT_MulDiv( distance,
v,
exc->F_dot_P ) );
else
#endif
if ( NO_SUBPIXEL_HINTING )
zone->cur[point].x = OVERFLOW_ADD_LONG(
zone->cur[point].x,
FT_MulDiv( distance, v, exc->F_dot_P ) );
zone->cur[point].x = ADD_LONG( zone->cur[point].x,
FT_MulDiv( distance,
v,
exc->F_dot_P ) );
zone->tags[point] |= FT_CURVE_TAG_TOUCH_X;
}
@ -1715,9 +1718,10 @@
exc->iupx_called &&
exc->iupy_called ) )
#endif
zone->cur[point].y = OVERFLOW_ADD_LONG(
zone->cur[point].y,
FT_MulDiv( distance, v, exc->F_dot_P ) );
zone->cur[point].y = ADD_LONG( zone->cur[point].y,
FT_MulDiv( distance,
v,
exc->F_dot_P ) );
zone->tags[point] |= FT_CURVE_TAG_TOUCH_Y;
}
@ -1753,16 +1757,18 @@
v = exc->GS.freeVector.x;
if ( v != 0 )
zone->org[point].x = OVERFLOW_ADD_LONG(
zone->org[point].x,
FT_MulDiv( distance, v, exc->F_dot_P ) );
zone->org[point].x = ADD_LONG( zone->org[point].x,
FT_MulDiv( distance,
v,
exc->F_dot_P ) );
v = exc->GS.freeVector.y;
if ( v != 0 )
zone->org[point].y = OVERFLOW_ADD_LONG(
zone->org[point].y,
FT_MulDiv( distance, v, exc->F_dot_P ) );
zone->org[point].y = ADD_LONG( zone->org[point].y,
FT_MulDiv( distance,
v,
exc->F_dot_P ) );
}
@ -1785,18 +1791,18 @@
{
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
if ( SUBPIXEL_HINTING_INFINALITY && !exc->ignore_x_mode )
zone->cur[point].x = OVERFLOW_ADD_LONG( zone->cur[point].x, distance );
zone->cur[point].x = ADD_LONG( zone->cur[point].x, distance );
else
#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
if ( SUBPIXEL_HINTING_MINIMAL && !exc->backward_compatibility )
zone->cur[point].x = OVERFLOW_ADD_LONG( zone->cur[point].x, distance );
zone->cur[point].x = ADD_LONG( zone->cur[point].x, distance );
else
#endif
if ( NO_SUBPIXEL_HINTING )
zone->cur[point].x = OVERFLOW_ADD_LONG( zone->cur[point].x, distance );
zone->cur[point].x = ADD_LONG( zone->cur[point].x, distance );
zone->tags[point] |= FT_CURVE_TAG_TOUCH_X;
}
@ -1815,7 +1821,7 @@
exc->backward_compatibility &&
exc->iupx_called && exc->iupy_called ) )
#endif
zone->cur[point].y = OVERFLOW_ADD_LONG( zone->cur[point].y, distance );
zone->cur[point].y = ADD_LONG( zone->cur[point].y, distance );
zone->tags[point] |= FT_CURVE_TAG_TOUCH_Y;
}
@ -1839,7 +1845,7 @@
{
FT_UNUSED( exc );
zone->org[point].x = OVERFLOW_ADD_LONG( zone->org[point].x, distance );
zone->org[point].x = ADD_LONG( zone->org[point].x, distance );
}
@ -1851,7 +1857,7 @@
{
FT_UNUSED( exc );
zone->org[point].y = OVERFLOW_ADD_LONG( zone->org[point].y, distance );
zone->org[point].y = ADD_LONG( zone->org[point].y, distance );
}
@ -2842,7 +2848,7 @@
static void
Ins_ADD( FT_Long* args )
{
args[0] = OVERFLOW_ADD_LONG( args[0], args[1] );
args[0] = ADD_LONG( args[0], args[1] );
}
@ -2855,7 +2861,7 @@
static void
Ins_SUB( FT_Long* args )
{
args[0] = OVERFLOW_SUB_LONG( args[0], args[1] );
args[0] = SUB_LONG( args[0], args[1] );
}
@ -5408,8 +5414,7 @@
if ( !( SUBPIXEL_HINTING_MINIMAL &&
exc->backward_compatibility ) )
#endif
exc->zp2.cur[point].x = OVERFLOW_ADD_LONG( exc->zp2.cur[point].x,
dx );
exc->zp2.cur[point].x = ADD_LONG( exc->zp2.cur[point].x, dx );
if ( touch )
exc->zp2.tags[point] |= FT_CURVE_TAG_TOUCH_X;
@ -5423,8 +5428,7 @@
exc->iupx_called &&
exc->iupy_called ) )
#endif
exc->zp2.cur[point].y = OVERFLOW_ADD_LONG( exc->zp2.cur[point].y,
dy );
exc->zp2.cur[point].y = ADD_LONG( exc->zp2.cur[point].y, dy );
if ( touch )
exc->zp2.tags[point] |= FT_CURVE_TAG_TOUCH_Y;
@ -5799,18 +5803,17 @@
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
/* subpixel hinting - make MSIRP respect CVT cut-in; */
if ( SUBPIXEL_HINTING_INFINALITY &&
exc->ignore_x_mode &&
exc->GS.freeVector.x != 0 &&
FT_ABS( OVERFLOW_SUB_LONG( distance,
args[1] ) ) >= control_value_cutin )
if ( SUBPIXEL_HINTING_INFINALITY &&
exc->ignore_x_mode &&
exc->GS.freeVector.x != 0 &&
FT_ABS( SUB_LONG( distance, args[1] ) ) >= control_value_cutin )
distance = args[1];
#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
exc->func_move( exc,
&exc->zp1,
point,
OVERFLOW_SUB_LONG( args[1], distance ) );
SUB_LONG( args[1], distance ) );
exc->GS.rp1 = exc->GS.rp0;
exc->GS.rp2 = point;
@ -6459,19 +6462,19 @@
/* Cramer's rule */
dbx = OVERFLOW_SUB_LONG( exc->zp0.cur[b1].x, exc->zp0.cur[b0].x );
dby = OVERFLOW_SUB_LONG( exc->zp0.cur[b1].y, exc->zp0.cur[b0].y );
dbx = SUB_LONG( exc->zp0.cur[b1].x, exc->zp0.cur[b0].x );
dby = SUB_LONG( exc->zp0.cur[b1].y, exc->zp0.cur[b0].y );
dax = OVERFLOW_SUB_LONG( exc->zp1.cur[a1].x, exc->zp1.cur[a0].x );
day = OVERFLOW_SUB_LONG( exc->zp1.cur[a1].y, exc->zp1.cur[a0].y );
dax = SUB_LONG( exc->zp1.cur[a1].x, exc->zp1.cur[a0].x );
day = SUB_LONG( exc->zp1.cur[a1].y, exc->zp1.cur[a0].y );
dx = OVERFLOW_SUB_LONG( exc->zp0.cur[b0].x, exc->zp1.cur[a0].x );
dy = OVERFLOW_SUB_LONG( exc->zp0.cur[b0].y, exc->zp1.cur[a0].y );
dx = SUB_LONG( exc->zp0.cur[b0].x, exc->zp1.cur[a0].x );
dy = SUB_LONG( exc->zp0.cur[b0].y, exc->zp1.cur[a0].y );
discriminant = OVERFLOW_ADD_LONG( FT_MulDiv( dax, -dby, 0x40 ),
FT_MulDiv( day, dbx, 0x40 ) );
dotproduct = OVERFLOW_ADD_LONG( FT_MulDiv( dax, dbx, 0x40 ),
FT_MulDiv( day, dby, 0x40 ) );
discriminant = ADD_LONG( FT_MulDiv( dax, -dby, 0x40 ),
FT_MulDiv( day, dbx, 0x40 ) );
dotproduct = ADD_LONG( FT_MulDiv( dax, dbx, 0x40 ),
FT_MulDiv( day, dby, 0x40 ) );
/* The discriminant above is actually a cross product of vectors */
/* da and db. Together with the dot product, they can be used as */
@ -6481,18 +6484,17 @@
/* discriminant = |da||db|sin(angle) . */
/* We use these equations to reject grazing intersections by */
/* thresholding abs(tan(angle)) at 1/19, corresponding to 3 degrees. */
if ( OVERFLOW_MUL_LONG( 19, FT_ABS( discriminant ) ) >
FT_ABS( dotproduct ) )
if ( MUL_LONG( 19, FT_ABS( discriminant ) ) > FT_ABS( dotproduct ) )
{
val = OVERFLOW_ADD_LONG( FT_MulDiv( dx, -dby, 0x40 ),
FT_MulDiv( dy, dbx, 0x40 ) );
val = ADD_LONG( FT_MulDiv( dx, -dby, 0x40 ),
FT_MulDiv( dy, dbx, 0x40 ) );
R.x = FT_MulDiv( val, dax, discriminant );
R.y = FT_MulDiv( val, day, discriminant );
/* XXX: Block in backward_compatibility and/or post-IUP? */
exc->zp2.cur[point].x = OVERFLOW_ADD_LONG( exc->zp1.cur[a0].x, R.x );
exc->zp2.cur[point].y = OVERFLOW_ADD_LONG( exc->zp1.cur[a0].y, R.y );
exc->zp2.cur[point].x = ADD_LONG( exc->zp1.cur[a0].x, R.x );
exc->zp2.cur[point].y = ADD_LONG( exc->zp1.cur[a0].y, R.y );
}
else
{
@ -6500,15 +6502,11 @@
/* XXX: Block in backward_compatibility and/or post-IUP? */
exc->zp2.cur[point].x =
OVERFLOW_ADD_LONG( OVERFLOW_ADD_LONG( exc->zp1.cur[a0].x,
exc->zp1.cur[a1].x ),
OVERFLOW_ADD_LONG( exc->zp0.cur[b0].x,
exc->zp0.cur[b1].x ) ) / 4;
ADD_LONG( ADD_LONG( exc->zp1.cur[a0].x, exc->zp1.cur[a1].x ),
ADD_LONG( exc->zp0.cur[b0].x, exc->zp0.cur[b1].x ) ) / 4;
exc->zp2.cur[point].y =
OVERFLOW_ADD_LONG( OVERFLOW_ADD_LONG( exc->zp1.cur[a0].y,
exc->zp1.cur[a1].y ),
OVERFLOW_ADD_LONG( exc->zp0.cur[b0].y,
exc->zp0.cur[b1].y ) ) / 4;
ADD_LONG( ADD_LONG( exc->zp1.cur[a0].y, exc->zp1.cur[a1].y ),
ADD_LONG( exc->zp0.cur[b0].y, exc->zp0.cur[b1].y ) ) / 4;
}
exc->zp2.tags[point] |= FT_CURVE_TAG_TOUCH_BOTH;