]> www.fi.muni.cz Git - evince.git/blob - pdf/splash/SplashMath.h
Clear idle stack before unsetting the document
[evince.git] / pdf / splash / SplashMath.h
1 //========================================================================
2 //
3 // SplashMath.h
4 //
5 //========================================================================
6
7 #ifndef SPLASHMATH_H
8 #define SPLASHMATH_H
9
10 #include <aconf.h>
11 #include <math.h>
12 #include "SplashTypes.h"
13
14 static inline SplashCoord splashAbs(SplashCoord x) {
15   return fabs(x);
16 }
17
18 static inline int splashFloor(SplashCoord x) {
19   return (int)floor(x);
20 }
21
22 static inline int splashCeil(SplashCoord x) {
23   return (int)ceil(x);
24 }
25
26 static inline int splashRound(SplashCoord x) {
27   return (int)floor(x + 0.5);
28 }
29
30 static inline SplashCoord splashSqrt(SplashCoord x) {
31   return sqrt(x);
32 }
33
34 static inline SplashCoord splashPow(SplashCoord x, SplashCoord y) {
35   return pow(x, y);
36 }
37
38 static inline SplashCoord splashDist(SplashCoord x0, SplashCoord y0,
39                                      SplashCoord x1, SplashCoord y1) {
40   SplashCoord dx, dy;
41   dx = x1 - x0;
42   dy = y1 - y0;
43   return sqrt(dx * dx + dy * dy);
44 }
45
46 #endif