[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.
This commit is contained in:
Emmanuele Bassi 2009-03-05 20:15:00 +00:00
parent 4e98fc5e79
commit 7bf385a067

View File

@ -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