Flutter Engine
The Flutter Engine
|
#include "include/private/base/SkAssert.h"
#include "include/private/base/SkFloatingPoint.h"
#include <cmath>
Go to the source code of this file.
Macros | |
#define | SK_Scalar1 1.0f |
#define | SK_ScalarHalf 0.5f |
#define | SK_ScalarSqrt2 SK_FloatSqrt2 |
#define | SK_ScalarPI SK_FloatPI |
#define | SK_ScalarTanPIOver8 0.414213562f |
#define | SK_ScalarRoot2Over2 0.707106781f |
#define | SK_ScalarMax 3.402823466e+38f |
#define | SK_ScalarMin (-SK_ScalarMax) |
#define | SK_ScalarInfinity SK_FloatInfinity |
#define | SK_ScalarNegativeInfinity SK_FloatNegativeInfinity |
#define | SK_ScalarNaN SK_FloatNaN |
#define | SkScalarFloorToScalar(x) std::floor(x) |
#define | SkScalarCeilToScalar(x) std::ceil(x) |
#define | SkScalarRoundToScalar(x) sk_float_round(x) |
#define | SkScalarTruncToScalar(x) std::trunc(x) |
#define | SkScalarFloorToInt(x) sk_float_floor2int(x) |
#define | SkScalarCeilToInt(x) sk_float_ceil2int(x) |
#define | SkScalarRoundToInt(x) sk_float_round2int(x) |
#define | SkScalarAbs(x) std::fabs(x) |
#define | SkScalarCopySign(x, y) std::copysign(x, y) |
#define | SkScalarMod(x, y) std::fmod(x,y) |
#define | SkScalarSqrt(x) std::sqrt(x) |
#define | SkScalarPow(b, e) std::pow(b, e) |
#define | SkScalarSin(radians) ((float)std::sin(radians)) |
#define | SkScalarCos(radians) ((float)std::cos(radians)) |
#define | SkScalarTan(radians) ((float)std::tan(radians)) |
#define | SkScalarASin(val) ((float)std::asin(val)) |
#define | SkScalarACos(val) ((float)std::acos(val)) |
#define | SkScalarATan2(y, x) ((float)std::atan2(y,x)) |
#define | SkScalarExp(x) ((float)std::exp(x)) |
#define | SkScalarLog(x) ((float)std::log(x)) |
#define | SkScalarLog2(x) ((float)std::log2(x)) |
#define | SkIntToScalar(x) static_cast<SkScalar>(x) |
#define | SkIntToFloat(x) static_cast<float>(x) |
#define | SkScalarTruncToInt(x) sk_float_saturate2int(x) |
#define | SkScalarToFloat(x) static_cast<float>(x) |
#define | SkFloatToScalar(x) static_cast<SkScalar>(x) |
#define | SkScalarToDouble(x) static_cast<double>(x) |
#define | SkDoubleToScalar(x) sk_double_to_float(x) |
#define | SkScalarInvert(x) (SK_Scalar1 / (x)) |
#define | SkScalarAve(a, b) (((a) + (b)) * SK_ScalarHalf) |
#define | SkScalarHalf(a) ((a) * SK_ScalarHalf) |
#define | SkDegreesToRadians(degrees) ((degrees) * (SK_ScalarPI / 180)) |
#define | SkRadiansToDegrees(radians) ((radians) * (180 / SK_ScalarPI)) |
#define | SK_ScalarNearlyZero (SK_Scalar1 / (1 << 12)) |
#define | SK_ScalarSinCosNearlyZero (SK_Scalar1 / (1 << 16)) |
Typedefs | |
typedef float | SkScalar |
Functions | |
static SkScalar | SkScalarFraction (SkScalar x) |
static SkScalar | SkScalarSquare (SkScalar x) |
static bool | SkScalarIsInt (SkScalar x) |
static int | SkScalarSignAsInt (SkScalar x) |
static SkScalar | SkScalarSignAsScalar (SkScalar x) |
static bool | SkScalarNearlyZero (SkScalar x, SkScalar tolerance=SK_ScalarNearlyZero) |
static bool | SkScalarNearlyEqual (SkScalar x, SkScalar y, SkScalar tolerance=SK_ScalarNearlyZero) |
static float | SkScalarSinSnapToZero (SkScalar radians) |
static float | SkScalarCosSnapToZero (SkScalar radians) |
static SkScalar | SkScalarInterp (SkScalar A, SkScalar B, SkScalar t) |
SkScalar | SkScalarInterpFunc (SkScalar searchKey, const SkScalar keys[], const SkScalar values[], int length) |
static bool | SkScalarsEqual (const SkScalar a[], const SkScalar b[], int n) |
#define SK_Scalar1 1.0f |
Definition at line 18 of file SkScalar.h.
#define SK_ScalarHalf 0.5f |
Definition at line 19 of file SkScalar.h.
#define SK_ScalarInfinity SK_FloatInfinity |
Definition at line 26 of file SkScalar.h.
#define SK_ScalarMax 3.402823466e+38f |
Definition at line 24 of file SkScalar.h.
#define SK_ScalarMin (-SK_ScalarMax) |
Definition at line 25 of file SkScalar.h.
#define SK_ScalarNaN SK_FloatNaN |
Definition at line 28 of file SkScalar.h.
#define SK_ScalarNearlyZero (SK_Scalar1 / (1 << 12)) |
Definition at line 99 of file SkScalar.h.
#define SK_ScalarNegativeInfinity SK_FloatNegativeInfinity |
Definition at line 27 of file SkScalar.h.
#define SK_ScalarPI SK_FloatPI |
Definition at line 21 of file SkScalar.h.
#define SK_ScalarRoot2Over2 0.707106781f |
Definition at line 23 of file SkScalar.h.
#define SK_ScalarSinCosNearlyZero (SK_Scalar1 / (1 << 16)) |
Definition at line 113 of file SkScalar.h.
#define SK_ScalarSqrt2 SK_FloatSqrt2 |
Definition at line 20 of file SkScalar.h.
#define SK_ScalarTanPIOver8 0.414213562f |
Definition at line 22 of file SkScalar.h.
#define SkDegreesToRadians | ( | degrees | ) | ((degrees) * (SK_ScalarPI / 180)) |
Definition at line 77 of file SkScalar.h.
#define SkDoubleToScalar | ( | x | ) | sk_double_to_float(x) |
Definition at line 64 of file SkScalar.h.
Definition at line 62 of file SkScalar.h.
Definition at line 58 of file SkScalar.h.
Definition at line 57 of file SkScalar.h.
#define SkRadiansToDegrees | ( | radians | ) | ((radians) * (180 / SK_ScalarPI)) |
Definition at line 78 of file SkScalar.h.
Definition at line 39 of file SkScalar.h.
#define SkScalarACos | ( | val | ) | ((float)std::acos(val)) |
Definition at line 49 of file SkScalar.h.
#define SkScalarASin | ( | val | ) | ((float)std::asin(val)) |
Definition at line 48 of file SkScalar.h.
#define SkScalarAve | ( | a, | |
b | |||
) | (((a) + (b)) * SK_ScalarHalf) |
Definition at line 74 of file SkScalar.h.
#define SkScalarCeilToInt | ( | x | ) | sk_float_ceil2int(x) |
Definition at line 36 of file SkScalar.h.
Definition at line 31 of file SkScalar.h.
#define SkScalarCos | ( | radians | ) | ((float)std::cos(radians)) |
Definition at line 46 of file SkScalar.h.
Definition at line 51 of file SkScalar.h.
#define SkScalarFloorToInt | ( | x | ) | sk_float_floor2int(x) |
Definition at line 35 of file SkScalar.h.
Definition at line 30 of file SkScalar.h.
#define SkScalarHalf | ( | a | ) | ((a) * SK_ScalarHalf) |
Definition at line 75 of file SkScalar.h.
#define SkScalarInvert | ( | x | ) | (SK_Scalar1 / (x)) |
Definition at line 73 of file SkScalar.h.
Definition at line 52 of file SkScalar.h.
Definition at line 53 of file SkScalar.h.
Definition at line 43 of file SkScalar.h.
#define SkScalarRoundToInt | ( | x | ) | sk_float_round2int(x) |
Definition at line 37 of file SkScalar.h.
#define SkScalarRoundToScalar | ( | x | ) | sk_float_round(x) |
Definition at line 32 of file SkScalar.h.
#define SkScalarSin | ( | radians | ) | ((float)std::sin(radians)) |
Definition at line 45 of file SkScalar.h.
Definition at line 42 of file SkScalar.h.
#define SkScalarTan | ( | radians | ) | ((float)std::tan(radians)) |
Definition at line 47 of file SkScalar.h.
Definition at line 63 of file SkScalar.h.
Definition at line 61 of file SkScalar.h.
#define SkScalarTruncToInt | ( | x | ) | sk_float_saturate2int(x) |
Definition at line 59 of file SkScalar.h.
Definition at line 33 of file SkScalar.h.
typedef float SkScalar |
Definition at line 16 of file SkScalar.h.
|
inlinestatic |
Definition at line 120 of file SkScalar.h.
Linearly interpolate between A and B, based on t. If t is 0, return A If t is 1, return B else interpolate. t must be [0..SK_Scalar1]
Definition at line 131 of file SkScalar.h.
SkScalar SkScalarInterpFunc | ( | SkScalar | searchKey, |
const SkScalar | keys[], | ||
const SkScalar | values[], | ||
int | length | ||
) |
Interpolate along the function described by (keys[length], values[length]) for the passed searchKey. SearchKeys outside the range keys[0]-keys[Length] clamp to the min or max value. This function assumes the number of pairs (length) will be small and a linear search is used.
Repeated keys are allowed for discontinuous functions (so long as keys is monotonically increasing). If key is the value of a repeated scalar in keys the first one will be used.
Definition at line 11 of file SkScalar.cpp.
|
inlinestatic |
Definition at line 80 of file SkScalar.h.
|
inlinestatic |
Definition at line 107 of file SkScalar.h.
|
inlinestatic |
Definition at line 101 of file SkScalar.h.
Returns -1 || 0 || 1 depending on the sign of value: -1 if x < 0 0 if x == 0 1 if x > 0
Definition at line 90 of file SkScalar.h.
Definition at line 95 of file SkScalar.h.
|
inlinestatic |
Definition at line 115 of file SkScalar.h.