mirror of
https://github.com/brl/mutter.git
synced 2024-11-23 00:20:42 -05:00
added CLUTTER_FLOAT_TO_UINT
This commit is contained in:
parent
d7caae7f6a
commit
cbf2830e5f
@ -787,7 +787,7 @@ clutter_pow2x (ClutterFixed x)
|
|||||||
union
|
union
|
||||||
{
|
{
|
||||||
float f;
|
float f;
|
||||||
ClutterFixed i;
|
guint32 i;
|
||||||
} flt;
|
} flt;
|
||||||
|
|
||||||
ClutterFixed magic = 0x56f7;
|
ClutterFixed magic = 0x56f7;
|
||||||
@ -810,7 +810,7 @@ clutter_pow2x (ClutterFixed x)
|
|||||||
flt.i += (CLUTTER_INT_TO_FIXED (127) - y);
|
flt.i += (CLUTTER_INT_TO_FIXED (127) - y);
|
||||||
flt.i <<= 7;
|
flt.i <<= 7;
|
||||||
|
|
||||||
return CLUTTER_FLOAT_TO_INT (flt.f);
|
return CLUTTER_FLOAT_TO_UINT (flt.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -892,5 +892,19 @@ _clutter_double_to_int (double val)
|
|||||||
return ((int)dbl.i[0]) >> 16;
|
return ((int)dbl.i[0]) >> 16;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
guint
|
||||||
|
_clutter_double_to_uint (double val)
|
||||||
|
{
|
||||||
|
union
|
||||||
|
{
|
||||||
|
double d;
|
||||||
|
unsigned int i[2];
|
||||||
|
} dbl;
|
||||||
|
|
||||||
|
dbl.d = val;
|
||||||
|
dbl.d = dbl.d + _magic;
|
||||||
|
return (dbl.i[0]) >> 16;
|
||||||
|
}
|
||||||
|
|
||||||
#undef _CFX_MAN
|
#undef _CFX_MAN
|
||||||
|
|
||||||
|
@ -127,6 +127,7 @@ typedef gint32 ClutterAngle; /* angle such that 1024 == 2*PI */
|
|||||||
|
|
||||||
#define CLUTTER_FLOAT_TO_FIXED(x) (_clutter_double_to_fixed ((x)))
|
#define CLUTTER_FLOAT_TO_FIXED(x) (_clutter_double_to_fixed ((x)))
|
||||||
#define CLUTTER_FLOAT_TO_INT(x) (_clutter_double_to_int ((x)))
|
#define CLUTTER_FLOAT_TO_INT(x) (_clutter_double_to_int ((x)))
|
||||||
|
#define CLUTTER_FLOAT_TO_UINT(x) (_clutter_double_to_uint ((x)))
|
||||||
|
|
||||||
#define CLUTTER_INT_TO_FIXED(x) ((x) << CFX_Q)
|
#define CLUTTER_INT_TO_FIXED(x) ((x) << CFX_Q)
|
||||||
#define CLUTTER_FIXED_INT(x) ((x) >> CFX_Q)
|
#define CLUTTER_FIXED_INT(x) ((x) >> CFX_Q)
|
||||||
@ -201,6 +202,9 @@ ClutterFixed _clutter_double_to_fixed (double value);
|
|||||||
extern inline
|
extern inline
|
||||||
gint _clutter_double_to_int (double value);
|
gint _clutter_double_to_int (double value);
|
||||||
|
|
||||||
|
extern inline
|
||||||
|
guint _clutter_double_to_uint (double value);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* _HAVE_CLUTTER_FIXED_H */
|
#endif /* _HAVE_CLUTTER_FIXED_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user