diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2010-03-26 19:37:08 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2010-05-12 20:54:49 +0100 |
commit | bd672d080ca0036ef1b88d26583e6af36f541461 (patch) | |
tree | 78504de713e643fc0909fc1c3e9fbfb30f9b28af /src/cairo-fixed-private.h | |
parent | c8fba4960339797521afbf8068fcbe62d064f5dc (diff) | |
download | cairo-bd672d080ca0036ef1b88d26583e6af36f541461.tar.gz |
drm: code dump, sorry.
Lots upon lots of tiny fixes mixed in with experimental code. :(
Diffstat (limited to 'src/cairo-fixed-private.h')
-rw-r--r-- | src/cairo-fixed-private.h | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/cairo-fixed-private.h b/src/cairo-fixed-private.h index 9deec800b..66898a20f 100644 --- a/src/cairo-fixed-private.h +++ b/src/cairo-fixed-private.h @@ -135,6 +135,16 @@ _cairo_fixed_from_26_6 (uint32_t i) #endif } +static inline cairo_fixed_t +_cairo_fixed_from_16_16 (uint32_t i) +{ +#if CAIRO_FIXED_FRAC_BITS > 16 + return i << (CAIRO_FIXED_FRAC_BITS - 16); +#else + return i >> (16 - CAIRO_FIXED_FRAC_BITS); +#endif +} + static inline double _cairo_fixed_to_double (cairo_fixed_t f) { @@ -242,7 +252,7 @@ _cairo_fixed_16_16_from_double (double d) } static inline int -_cairo_fixed_16_16_floor (cairo_fixed_t f) +_cairo_fixed_16_16_floor (cairo_fixed_16_16_t f) { if (f >= 0) return f >> 16; @@ -250,6 +260,12 @@ _cairo_fixed_16_16_floor (cairo_fixed_t f) return -((-f - 1) >> 16) - 1; } +static inline double +_cairo_fixed_16_16_to_double (cairo_fixed_16_16_t f) +{ + return ((double) f) / (double) (1 << 16); +} + #if CAIRO_FIXED_BITS == 32 static inline cairo_fixed_t |