Flutter Engine
The Flutter Engine
Macros | Typedefs | Functions
SkFDot6.h File Reference
#include "include/core/SkScalar.h"
#include "include/private/base/SkFixed.h"
#include "include/private/base/SkMath.h"
#include "include/private/base/SkTo.h"

Go to the source code of this file.

Macros

#define SK_FDot6One   (64)
 
#define SK_FDot6Half   (32)
 
#define SkIntToFDot6(x)   ((x) << 6)
 
#define SkFDot6Floor(x)   ((x) >> 6)
 
#define SkFDot6Ceil(x)   (((x) + 63) >> 6)
 
#define SkFDot6Round(x)   (((x) + 32) >> 6)
 
#define SkFixedToFDot6(x)   ((x) >> 10)
 
#define SkScalarToFDot6(x)   (SkFDot6)((x) * 64)
 
#define SkFDot6ToScalar(x)   ((SkScalar)(x) * 0.015625f)
 
#define SkFDot6ToFloat   SkFDot6ToScalar
 

Typedefs

typedef int32_t SkFDot6
 

Functions

SkFDot6 SkScalarRoundToFDot6 (SkScalar x, int shift=0)
 
SkFixed SkFDot6ToFixed (SkFDot6 x)
 
SkFixed SkFDot6Div (SkFDot6 a, SkFDot6 b)
 

Macro Definition Documentation

◆ SK_FDot6Half

#define SK_FDot6Half   (32)

Definition at line 41 of file SkFDot6.h.

◆ SK_FDot6One

#define SK_FDot6One   (64)

Definition at line 40 of file SkFDot6.h.

◆ SkFDot6Ceil

#define SkFDot6Ceil (   x)    (((x) + 63) >> 6)

Definition at line 53 of file SkFDot6.h.

◆ SkFDot6Floor

#define SkFDot6Floor (   x)    ((x) >> 6)

Definition at line 52 of file SkFDot6.h.

◆ SkFDot6Round

#define SkFDot6Round (   x)    (((x) + 32) >> 6)

Definition at line 54 of file SkFDot6.h.

◆ SkFDot6ToFloat

#define SkFDot6ToFloat   SkFDot6ToScalar

Definition at line 66 of file SkFDot6.h.

◆ SkFDot6ToScalar

#define SkFDot6ToScalar (   x)    ((SkScalar)(x) * 0.015625f)

Definition at line 65 of file SkFDot6.h.

◆ SkFixedToFDot6

#define SkFixedToFDot6 (   x)    ((x) >> 10)

Definition at line 56 of file SkFDot6.h.

◆ SkIntToFDot6

#define SkIntToFDot6 (   x)    ((x) << 6)

Definition at line 49 of file SkFDot6.h.

◆ SkScalarToFDot6

#define SkScalarToFDot6 (   x)    (SkFDot6)((x) * 64)

Definition at line 64 of file SkFDot6.h.

Typedef Documentation

◆ SkFDot6

typedef int32_t SkFDot6

Definition at line 16 of file SkFDot6.h.

Function Documentation

◆ SkFDot6Div()

SkFixed SkFDot6Div ( SkFDot6  a,
SkFDot6  b 
)
inline

Definition at line 68 of file SkFDot6.h.

68 {
69 SkASSERT(b != 0);
70
71 if (SkTFitsIn<int16_t>(a)) {
72 return SkLeftShift(a, 16) / b;
73 } else {
74 return SkFixedDiv(a, b);
75 }
76}
#define SkASSERT(cond)
Definition: SkAssert.h:116
#define SkFixedDiv(numer, denom)
Definition: SkFixed.h:93
static constexpr int32_t SkLeftShift(int32_t value, int32_t shift)
Definition: SkMath.h:37
static bool b
struct MyStruct a[10]

◆ SkFDot6ToFixed()

SkFixed SkFDot6ToFixed ( SkFDot6  x)
inline

Definition at line 58 of file SkFDot6.h.

58 {
59 SkASSERT((SkLeftShift(x, 10) >> 10) == x);
60
61 return SkLeftShift(x, 10);
62}
double x

◆ SkScalarRoundToFDot6()

SkFDot6 SkScalarRoundToFDot6 ( SkScalar  x,
int  shift = 0 
)
inline

Definition at line 23 of file SkFDot6.h.

24{
25 union {
26 double fDouble;
27 int32_t fBits[2];
28 } tmp;
29 int fractionalBits = 6 + shift;
30 double magic = (1LL << (52 - (fractionalBits))) * 1.5;
31
32 tmp.fDouble = SkScalarToDouble(x) + magic;
33#ifdef SK_CPU_BENDIAN
34 return tmp.fBits[1];
35#else
36 return tmp.fBits[0];
37#endif
38}
#define SkScalarToDouble(x)
Definition: SkScalar.h:63