#define SkScalarFloorToScalar(x) sk_float_floor(x)
#define SkScalarCeilToScalar(x) sk_float_ceil(x)
#define SkScalarRoundToScalar(x) sk_float_floor((x) + 0.5f)
+#define SkScalarTruncToScalar(x) sk_float_trunc(x)
#define SkScalarFloorToInt(x) sk_float_floor2int(x)
#define SkScalarCeilToInt(x) sk_float_ceil2int(x)
#define SkScalarAbs(x) sk_float_abs(x)
#define SkScalarCopySign(x, y) sk_float_copysign(x, y)
#define SkScalarMod(x, y) sk_float_mod(x,y)
-#define SkScalarFraction(x) sk_float_mod(x, 1.0f)
#define SkScalarSqrt(x) sk_float_sqrt(x)
#define SkScalarPow(b, e) sk_float_pow(b, e)
#define SkScalarFloorToScalar(x) floor(x)
#define SkScalarCeilToScalar(x) ceil(x)
#define SkScalarRoundToScalar(x) floor((x) + 0.5)
+#define SkScalarTruncToScalar(x) trunc(x)
#define SkScalarFloorToInt(x) (int)floor(x)
#define SkScalarCeilToInt(x) (int)ceil(x)
#define SkScalarAbs(x) abs(x)
#define SkScalarCopySign(x, y) copysign(x, y)
#define SkScalarMod(x, y) fmod(x,y)
-#define SkScalarFraction(x) fmod(x, 1.0)
#define SkScalarSqrt(x) sqrt(x)
#define SkScalarPow(b, e) pow(b, e)
return (int)floor(xx);
}
+/** Returns the fractional part of the scalar. */
+static inline SkScalar SkScalarFraction(SkScalar x) {
+ return x - SkScalarTruncToScalar(x);
+}
+
static inline SkScalar SkScalarClampMax(SkScalar x, SkScalar max) {
x = SkTMin(x, max);
x = SkTMax<SkScalar>(x, 0);