Add _cairo_round()

_cairo_round() has the same behaviour as _cairo_lround() except
it returns a double instead of an integer.
This commit is contained in:
Jeff Muizelaar 2009-02-10 17:53:39 -05:00
parent 41e46c7754
commit dffdbd8515

View file

@ -1024,6 +1024,15 @@ typedef struct _cairo_stroke_face {
cairo_private void
_cairo_restrict_value (double *value, double min, double max);
/* C99 round() rounds to the nearest integral value with halfway cases rounded
* away from 0. _cairo_round rounds halfway cases toward negative infinity.
* This matches the rounding behaviour of _cairo_lround. */
static inline double
_cairo_round (double r)
{
return floor (r + .5);
}
cairo_private int
_cairo_lround (double d);