[base, pshinter] Use FT_ABS, FT_MIN, and FT_MAX for readability.

* src/base/ftbbox.c: Updated.
* src/base/ftobjs.c: Updated.
* src/base/fttrigon.c: Updated.
* src/pshinter/pshalgo.c: Updated.
* src/pshinter/pshrec.c: Updated.
This commit is contained in:
Alexei Podtelezhnikov 2013-01-09 00:25:32 -05:00
parent 09dbb059e1
commit 6b83a3674c
6 changed files with 27 additions and 17 deletions

View File

@ -1,3 +1,13 @@
2013-01-09 Alexei Podtelezhnikov <apodtele@gmail.com>
[base, pshinter] Use FT_ABS, FT_MIN, and FT_MAX for readability.
* src/base/ftbbox.c: Updated.
* src/base/ftobjs.c: Updated.
* src/base/fttrigon.c: Updated.
* src/pshinter/pshalgo.c: Updated.
* src/pshinter/pshrec.c: Updated.
2013-01-08 Alexei Podtelezhnikov <apodtele@gmail.com>
[base] Clean up trigonometric core.

View File

@ -4,7 +4,7 @@
/* */
/* FreeType bbox computation (body). */
/* */
/* Copyright 1996-2001, 2002, 2004, 2006, 2010 by */
/* Copyright 1996-2002, 2004, 2006, 2010, 2013 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used */
@ -400,10 +400,10 @@
/* We begin by computing `t1' as the bitwise `OR' of the */
/* absolute values of `a', `b', `c'. */
t1 = (FT_ULong)( ( a >= 0 ) ? a : -a );
t2 = (FT_ULong)( ( b >= 0 ) ? b : -b );
t1 = (FT_ULong)FT_ABS( a );
t2 = (FT_ULong)FT_ABS( b );
t1 |= t2;
t2 = (FT_ULong)( ( c >= 0 ) ? c : -c );
t2 = (FT_ULong)FT_ABS( c );
t1 |= t2;
/* Now we can be sure that the most significant bit of `t1' */

View File

@ -4,7 +4,7 @@
/* */
/* The FreeType private base classes (body). */
/* */
/* Copyright 1996-2012 by */
/* Copyright 1996-2013 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -1505,7 +1505,7 @@
error = open_face_from_buffer( library,
sfnt_ps,
length,
face_index < 0 ? face_index : 0,
FT_MIN( face_index, 0 ),
is_sfnt_cid ? "cid" : "type1",
aface );
Exit:

View File

@ -65,7 +65,7 @@
s = val;
val = ( val >= 0 ) ? val : -val;
val = FT_ABS( val );
v = ( val * (FT_Int64)FT_TRIG_SCALE ) + 0x100000000UL;
val = (FT_Fixed)( v >> 32 );
@ -84,7 +84,7 @@
s = val;
val = ( val >= 0 ) ? val : -val;
val = FT_ABS( val );
v1 = (FT_UInt32)val >> 16;
v2 = (FT_UInt32)( val & 0xFFFFL );
@ -96,7 +96,7 @@
lo1 = k1 * v2 + k2 * v1; /* can't overflow */
lo2 = ( k2 * v2 ) >> 16;
lo3 = ( lo1 >= lo2 ) ? lo1 : lo2;
lo3 = FT_MAX( lo1, lo2 );
lo1 += lo2;
hi += lo1 >> 16;
@ -121,7 +121,7 @@
x = vec->x;
y = vec->y;
z = ( ( x >= 0 ) ? x : - x ) | ( (y >= 0) ? y : -y );
z = FT_ABS( x ) | FT_ABS( y );
shift = 0;
#if 1
@ -464,11 +464,11 @@
/* handle trivial cases */
if ( v.x == 0 )
{
return ( v.y >= 0 ) ? v.y : -v.y;
return FT_ABS( v.y );
}
else if ( v.y == 0 )
{
return ( v.x >= 0 ) ? v.x : -v.x;
return FT_ABS( v.x );
}
/* general case */

View File

@ -4,7 +4,7 @@
/* */
/* PostScript hinting algorithm (body). */
/* */
/* Copyright 2001-2010, 2012 by */
/* Copyright 2001-2010, 2012, 2013 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used */
@ -1161,8 +1161,8 @@
int result = PSH_DIR_NONE;
ax = ( dx >= 0 ) ? dx : -dx;
ay = ( dy >= 0 ) ? dy : -dy;
ax = FT_ABS( dx );
ay = FT_ABS( dy );
if ( ay * 12 < ax )
{

View File

@ -4,7 +4,7 @@
/* */
/* FreeType PostScript hints recorder (body). */
/* */
/* Copyright 2001, 2002, 2003, 2004, 2007, 2009 by */
/* Copyright 2001-2004, 2007, 2009, 2013 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -384,7 +384,7 @@
FT_UInt count;
count = ( count1 <= count2 ) ? count1 : count2;
count = FT_MIN( count1, count2 );
for ( ; count >= 8; count -= 8 )
{
if ( p1[0] & p2[0] )