deprecate SkScalarFloor, SkScalarCeil, SkScalarRound

Should instead use the explicit version that returns either a scalar or int

e.g.
    SkScalarRoundToInt
    SkScalarROundToScalar



git-svn-id: http://skia.googlecode.com/svn/trunk@2018 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
reed@google.com 2011-08-01 20:49:45 +00:00
parent 14fc32114b
commit 1b20280f9b
2 changed files with 38 additions and 20 deletions

View File

@ -96,17 +96,23 @@ inline SkFixed SkFixedFraction(SkFixed x)
/** Converts a SkFract to a SkFixed
*/
#define SkFractToFixed(x) ((x) >> 14)
/** Round a SkFixed to an integer
*/
#define SkFixedRound(x) (((x) + SK_FixedHalf) >> 16)
#define SkFixedCeil(x) (((x) + SK_Fixed1 - 1) >> 16)
#define SkFixedFloor(x) ((x) >> 16)
#define SkFixedRoundToInt(x) (((x) + SK_FixedHalf) >> 16)
#define SkFixedCeilToInt(x) (((x) + SK_Fixed1 - 1) >> 16)
#define SkFixedFloorToInt(x) ((x) >> 16)
#define SkFixedRoundToFixed(x) (((x) + SK_FixedHalf) & 0xFFFF0000)
#define SkFixedCeilToFixed(x) (((x) + SK_Fixed1 - 1) & 0xFFFF0000)
#define SkFixedFloorToFixed(x) ((x) & 0xFFFF0000)
// DEPRECATED
#define SkFixedFloor(x) SkFixedFloorToInt(x)
#define SkFixedCeil(x) SkFixedCeilToInt(x)
#define SkFixedRound(x) SkFixedRoundToInt(x)
#define SkFixedAbs(x) SkAbs32(x)
#define SkFixedAve(a, b) (((a) + (b)) >> 1)
// The same as SkIntToFixed(SkFixedFloor(x))
#define SkFixedFloorToFixed(x) ((x) & ~0xFFFF)
SkFixed SkFixedMul_portable(SkFixed, SkFixed);
SkFract SkFractMul_portable(SkFract, SkFract);
inline SkFixed SkFixedSquare_portable(SkFixed value)

View File

@ -116,15 +116,15 @@
/** SkScalarFraction(x) returns the signed fractional part of the argument
*/
#define SkScalarFraction(x) sk_float_mod(x, 1.0f)
/** Rounds the SkScalar to the nearest integer value
*/
#define SkScalarRound(x) sk_float_round2int(x)
/** Returns the smallest integer that is >= the specified SkScalar
*/
#define SkScalarCeil(x) sk_float_ceil2int(x)
/** Returns the largest integer that is <= the specified SkScalar
*/
#define SkScalarFloor(x) sk_float_floor2int(x)
#define SkScalarFloorToScalar(x) sk_float_floor(x)
#define SkScalarCeilToScalar(x) sk_float_ceil(x)
#define SkScalarRoundToScalar(x) sk_float_round(x)
#define SkScalarFloorToInt(x) sk_float_floor2int(x)
#define SkScalarCeilToInt(x) sk_float_ceil2int(x)
#define SkScalarRoundToInt(x) sk_float_round2int(x)
/** Returns the absolute value of the specified SkScalar
*/
#define SkScalarAbs(x) sk_float_abs(x)
@ -230,9 +230,15 @@
#define SkDoubleToScalar(n) SkDoubleToFixed(n)
#endif
#define SkScalarFraction(x) SkFixedFraction(x)
#define SkScalarRound(x) SkFixedRound(x)
#define SkScalarCeil(x) SkFixedCeil(x)
#define SkScalarFloor(x) SkFixedFloor(x)
#define SkScalarFloorToScalar(x) SkFixedFloorToFixed(x)
#define SkScalarCeilToScalar(x) SkFixedCeilToFixed(x)
#define SkScalarRoundToScalar(x) SkFixedRoundToFixed(x)
#define SkScalarFloorToInt(x) SkFixedFloorToInt(x)
#define SkScalarCeilToInt(x) SkFixedCeilToInt(x)
#define SkScalarRoundToInt(x) SkFixedRoundToInt(x)
#define SkScalarAbs(x) SkFixedAbs(x)
#define SkScalarCopySign(x, y) SkCopySign32(x, y)
#define SkScalarClampMax(x, max) SkClampMax(x, max)
@ -277,6 +283,12 @@
}
#endif
// DEPRECATED : use ToInt or ToScalar variant
#define SkScalarFloor(x) SkScalarFloorToInt(x)
#define SkScalarCeil(x) SkScalarCeilToInt(x)
#define SkScalarRound(x) SkScalarRoundToInt(x)
#define SK_ScalarNearlyZero (SK_Scalar1 / (1 << 12))
/* <= is slower than < for floats, so we use < for our tolerance test