26#define SK_Fixed1 (1 << 16)
27#define SK_FixedHalf (1 << 15)
28#define SK_FixedQuarter (1 << 14)
29#define SK_FixedMax (0x7FFFFFFF)
30#define SK_FixedMin (-SK_FixedMax)
31#define SK_FixedPI (0x3243F)
32#define SK_FixedSqrt2 (92682)
33#define SK_FixedTanPIOver8 (0x6A0A)
34#define SK_FixedRoot2Over2 (0xB505)
41#define SkFixedToFloat(x) ((x) * 1.52587890625e-5f)
42#define SkFloatToFixed(x) sk_float_saturate2int((x) * SK_Fixed1)
52 #define SkFloatToFixed_Check(x) SkFloatToFixed(x)
55#define SkFixedToDouble(x) ((x) * 1.52587890625e-5)
56#define SkDoubleToFixed(x) ((SkFixed)((x) * SK_Fixed1))
67 return (
SkFixed)( (unsigned)n << 16 );
73 #define SkIntToFixed(n) (SkFixed)((unsigned)(n) << 16)
76#define SkFixedRoundToInt(x) (((x) + SK_FixedHalf) >> 16)
77#define SkFixedCeilToInt(x) (((x) + SK_Fixed1 - 1) >> 16)
78#define SkFixedFloorToInt(x) ((x) >> 16)
87 return (
SkFixed)( (uint32_t)
x & 0xFFFF0000 );
90#define SkFixedAve(a, b) (((a) + (b)) >> 1)
93#define SkFixedDiv(numer, denom) \
94 SkToS32(SkTPin<int64_t>((SkLeftShift((int64_t)(numer), 16) / (denom)), SK_MinS32, SK_MaxS32))
104#if defined(__ARM_VFPV3__)
114 asm(
"vcvt.s32.f32 %0, %0, #16":
"+w"(
x));
115 std::memcpy(&
y, &
x,
sizeof(
y));
118 #undef SkFloatToFixed
119 #define SkFloatToFixed(x) SkFloatToFixed_arm(x)
124#define SkFixedToScalar(x) SkFixedToFloat(x)
125#define SkScalarToFixed(x) SkFloatToFixed(x)
131#define SkFixed3232Max SK_MaxS64
132#define SkFixed3232Min (-SkFixed3232Max)
134#define SkIntToFixed3232(x) (SkLeftShift((SkFixed3232)(x), 32))
135#define SkFixed3232ToInt(x) ((int)((x) >> 32))
136#define SkFixedToFixed3232(x) (SkLeftShift((SkFixed3232)(x), 16))
137#define SkFixed3232ToFixed(x) ((SkFixed)((x) >> 16))
138#define SkFloatToFixed3232(x) sk_float_saturate2int64((x) * (65536.0f * 65536.0f))
139#define SkFixed3232ToFloat(x) (x * (1 / (65536.0f * 65536.0f)))
141#define SkScalarToFixed3232(x) SkFloatToFixed3232(x)
#define SkFloatToFixed_Check(x)
static SkFixed SkFixedCeilToFixed(SkFixed x)
static SkFixed SkFixedFloorToFixed(SkFixed x)
static SkFixed SkFixedMul(SkFixed a, SkFixed b)
static SkFixed SkFixedRoundToFixed(SkFixed x)