1
//========================================================================
5
//========================================================================
12
#include "FixedPoint.h"
16
#include "SplashTypes.h"
18
static inline SplashCoord splashAbs(SplashCoord x) {
20
return FixedPoint::abs(x);
26
static inline int splashFloor(SplashCoord x) {
28
return FixedPoint::floor(x);
34
static inline int splashCeil(SplashCoord x) {
36
return FixedPoint::ceil(x);
42
static inline int splashRound(SplashCoord x) {
44
return FixedPoint::round(x);
46
return (int)floor(x + 0.5);
50
static inline SplashCoord splashSqrt(SplashCoord x) {
52
return FixedPoint::sqrt(x);
58
static inline SplashCoord splashPow(SplashCoord x, SplashCoord y) {
60
return FixedPoint::pow(x, y);
66
static inline SplashCoord splashDist(SplashCoord x0, SplashCoord y0,
67
SplashCoord x1, SplashCoord y1) {
72
// this handles the situation where dx*dx or dy*dy is too large to
73
// fit in the 16.16 fixed point format
77
if (dxa == 0 && dya == 0) {
79
} else if (dxa > dya) {
80
return dxa * FixedPoint::sqrt(dya / dxa + 1);
82
return dya * FixedPoint::sqrt(dxa / dya + 1);
85
return sqrt(dx * dx + dy * dy);