8#ifndef SkScalar_DEFINED
9#define SkScalar_DEFINED
18#define SK_Scalar1 1.0f
19#define SK_ScalarHalf 0.5f
20#define SK_ScalarSqrt2 SK_FloatSqrt2
21#define SK_ScalarPI SK_FloatPI
22#define SK_ScalarTanPIOver8 0.414213562f
23#define SK_ScalarRoot2Over2 0.707106781f
24#define SK_ScalarMax 3.402823466e+38f
25#define SK_ScalarMin (-SK_ScalarMax)
26#define SK_ScalarInfinity SK_FloatInfinity
27#define SK_ScalarNegativeInfinity SK_FloatNegativeInfinity
28#define SK_ScalarNaN SK_FloatNaN
30#define SkScalarFloorToScalar(x) std::floor(x)
31#define SkScalarCeilToScalar(x) std::ceil(x)
32#define SkScalarRoundToScalar(x) sk_float_round(x)
33#define SkScalarTruncToScalar(x) std::trunc(x)
35#define SkScalarFloorToInt(x) sk_float_floor2int(x)
36#define SkScalarCeilToInt(x) sk_float_ceil2int(x)
37#define SkScalarRoundToInt(x) sk_float_round2int(x)
39#define SkScalarAbs(x) std::fabs(x)
40#define SkScalarCopySign(x, y) std::copysign(x, y)
41#define SkScalarMod(x, y) std::fmod(x,y)
42#define SkScalarSqrt(x) std::sqrt(x)
43#define SkScalarPow(b, e) std::pow(b, e)
45#define SkScalarSin(radians) ((float)std::sin(radians))
46#define SkScalarCos(radians) ((float)std::cos(radians))
47#define SkScalarTan(radians) ((float)std::tan(radians))
48#define SkScalarASin(val) ((float)std::asin(val))
49#define SkScalarACos(val) ((float)std::acos(val))
50#define SkScalarATan2(y, x) ((float)std::atan2(y,x))
51#define SkScalarExp(x) ((float)std::exp(x))
52#define SkScalarLog(x) ((float)std::log(x))
53#define SkScalarLog2(x) ((float)std::log2(x))
57#define SkIntToScalar(x) static_cast<SkScalar>(x)
58#define SkIntToFloat(x) static_cast<float>(x)
59#define SkScalarTruncToInt(x) sk_float_saturate2int(x)
61#define SkScalarToFloat(x) static_cast<float>(x)
62#define SkFloatToScalar(x) static_cast<SkScalar>(x)
63#define SkScalarToDouble(x) static_cast<double>(x)
64#define SkDoubleToScalar(x) sk_double_to_float(x)
73#define SkScalarInvert(x) (SK_Scalar1 / (x))
74#define SkScalarAve(a, b) (((a) + (b)) * SK_ScalarHalf)
75#define SkScalarHalf(a) ((a) * SK_ScalarHalf)
77#define SkDegreesToRadians(degrees) ((degrees) * (SK_ScalarPI / 180))
78#define SkRadiansToDegrees(radians) ((radians) * (180 / SK_ScalarPI))
91 return x < 0 ? -1 : (
x > 0);
99#define SK_ScalarNearlyZero (SK_Scalar1 / (1 << 12))
113#define SK_ScalarSinCosNearlyZero (SK_Scalar1 / (1 << 16))
133 return A + (
B -
A) * t;
153 for (
int i = 0;
i < n; ++
i) {
static SkScalar SkScalarSignAsScalar(SkScalar x)
#define SkScalarTruncToScalar(x)
#define SK_ScalarSinCosNearlyZero
#define SkScalarFloorToScalar(x)
static float SkScalarSinSnapToZero(SkScalar radians)
static bool SkScalarNearlyZero(SkScalar x, SkScalar tolerance=SK_ScalarNearlyZero)
static int SkScalarSignAsInt(SkScalar x)
#define SkScalarSin(radians)
static bool SkScalarNearlyEqual(SkScalar x, SkScalar y, SkScalar tolerance=SK_ScalarNearlyZero)
#define SK_ScalarNearlyZero
#define SkScalarCos(radians)
static bool SkScalarIsInt(SkScalar x)
static SkScalar SkScalarInterp(SkScalar A, SkScalar B, SkScalar t)
SkScalar SkScalarInterpFunc(SkScalar searchKey, const SkScalar keys[], const SkScalar values[], int length)
static SkScalar SkScalarFraction(SkScalar x)
static SkScalar SkScalarSquare(SkScalar x)
static float SkScalarCosSnapToZero(SkScalar radians)
static bool SkScalarsEqual(const SkScalar a[], const SkScalar b[], int n)