From 7bf385a06700f152018626021cd2f2367572b3a2 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Thu, 5 Mar 2009 20:15:00 +0000 Subject: [PATCH] [cogl-fixed] Add a double-to-fixed conversion macro Since the conversion of a floating point value to a fixed point value is already done in double precision we can safely expose a macro that converts a double precision floating point value to a CoglFixed one. --- clutter/cogl/cogl-fixed.h | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/clutter/cogl/cogl-fixed.h b/clutter/cogl/cogl-fixed.h index 8d7c9e96a..0e51c3584 100644 --- a/clutter/cogl/cogl-fixed.h +++ b/clutter/cogl/cogl-fixed.h @@ -275,7 +275,7 @@ G_BEGIN_DECLS * * Since: 1.0 */ -#define COGL_FIXED_FROM_FLOAT(x) (cogl_double_to_fixed (x)) +#define COGL_FIXED_FROM_FLOAT(x) ((float) cogl_double_to_fixed (x)) /** * COGL_FIXED_TO_FLOAT: @@ -288,11 +288,22 @@ G_BEGIN_DECLS */ #define COGL_FIXED_TO_FLOAT(x) ((float) ((int)(x) / 65536.0)) +/** + * COGL_FIXED_FROM_DOUBLE: + * @x: a floating point number + * + * Converts @x from a double precision, floating point to a fixed + * point notation. + * + * Since: 1.0 + */ +#define COGL_FIXED_FROM_DOUBLE(x) (cogl_double_to_fixed (x)) + /** * COGL_FIXED_TO_FLOAT: * @x: a #CoglFixed number * - * Converts @x from a fixed point to a floatint point notation, in + * Converts @x from a fixed point to a floating point notation, in * double precision. * * Since: 1.0