mirror of
https://github.com/brl/mutter.git
synced 2024-11-10 07:56:14 -05:00
[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:
parent
a60d0aa231
commit
198dcef728
15
cogl-fixed.h
15
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
|
||||
|
Loading…
Reference in New Issue
Block a user