mutter/fixed-to-float-patches/clutter-units.h.0.patch
Neil Roberts 4e94500a2a Merge branch 'master' into cogl-float
The patches have been updated to apply cleanly.

The patches for the g_warnings in clutter-actor.c have been removed
because master now uses CLUTTER_UNITS_FORMAT so they aren't
necessary. The clutter-units.h patch now sets CLUTTER_UNITS_FORMAT to
'f'.
2009-01-15 18:26:22 +00:00

92 lines
3.1 KiB
Diff

diff --git a/clutter/clutter-units.h b/clutter/clutter-units.h
index b85375a..1084095 100644
--- a/clutter/clutter-units.h
+++ b/clutter/clutter-units.h
@@ -42,7 +42,7 @@ G_BEGIN_DECLS
*
* Since: 0.4
*/
-typedef gint32 ClutterUnit;
+typedef float ClutterUnit;
/*
* Currently CLUTTER_UNIT maps directly onto ClutterFixed. Nevertheless, the
@@ -50,16 +50,16 @@ typedef gint32 ClutterUnit;
* decide to change this relationship in the future.
*/
-#define CLUTTER_UNITS_FROM_INT(x) (COGL_FIXED_FROM_INT ((x)))
-#define CLUTTER_UNITS_TO_INT(x) (COGL_FIXED_TO_INT ((x)))
+#define CLUTTER_UNITS_FROM_INT(x) ((float)(x))
+#define CLUTTER_UNITS_TO_INT(x) ((int)(x))
-#define CLUTTER_UNITS_FROM_FLOAT(x) (COGL_FIXED_FROM_FLOAT ((x)))
-#define CLUTTER_UNITS_TO_FLOAT(x) (COGL_FIXED_TO_FLOAT ((x)))
+#define CLUTTER_UNITS_FROM_FLOAT(x) (x)
+#define CLUTTER_UNITS_TO_FLOAT(x) (x)
#define CLUTTER_UNITS_FROM_FIXED(x) (x)
#define CLUTTER_UNITS_TO_FIXED(x) (x)
-#define CLUTTER_UNITS_FORMAT "d"
+#define CLUTTER_UNITS_FORMAT "f"
/**
* CLUTTER_UNITS_FROM_DEVICE:
@@ -92,7 +92,7 @@ typedef gint32 ClutterUnit;
*
* Since: 0.6
*/
-#define CLUTTER_UNITS_FROM_PANGO_UNIT(x) ((x) << 6)
+#define CLUTTER_UNITS_FROM_PANGO_UNIT(x) ((float)(x / 1024))
/**
* CLUTTER_UNITS_TO_PANGO_UNIT:
@@ -102,7 +102,7 @@ typedef gint32 ClutterUnit;
*
* Since: 0.6
*/
-#define CLUTTER_UNITS_TO_PANGO_UNIT(x) ((x) >> 6)
+#define CLUTTER_UNITS_TO_PANGO_UNIT(x) ((int)(x * 1024))
#define CLUTTER_UNITS_FROM_STAGE_WIDTH_PERCENTAGE(x) \
((clutter_actor_get_widthu (clutter_stage_get_default ()) * x) / 100)
@@ -127,8 +127,7 @@ typedef gint32 ClutterUnit;
#define CLUTTER_UNITS_FROM_MM(x) \
(CLUTTER_UNITS_FROM_FLOAT ((((x) * clutter_stage_get_resolution ((ClutterStage *) clutter_stage_get_default ())) / 25.4)))
-#define CLUTTER_UNITS_FROM_MMX(x) \
- (CFX_DIV (CFX_MUL ((x), clutter_stage_get_resolutionx ((ClutterStage *) clutter_stage_get_default ())), 0x196666))
+#define CLUTTER_UNITS_FROM_MMX(x) CLUTTER_UNITS_FROM_MM
/**
* CLUTTER_UNITS_FROM_POINTS:
@@ -141,9 +140,6 @@ typedef gint32 ClutterUnit;
#define CLUTTER_UNITS_FROM_POINTS(x) \
CLUTTER_UNITS_FROM_FLOAT ((((x) * clutter_stage_get_resolution ((ClutterStage *) clutter_stage_get_default ())) / 72.0))
-#define CLUTTER_UNITS_FROM_POINTSX(x) \
- (CFX_MUL ((x), clutter_stage_get_resolutionx ((ClutterStage *) clutter_stage_get_default ())) / 72)
-
#define CLUTTER_TYPE_UNIT (clutter_unit_get_type ())
#define CLUTTER_TYPE_PARAM_UNIT (clutter_param_unit_get_type ())
#define CLUTTER_PARAM_SPEC_UNIT(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), CLUTTER_TYPE_PARAM_UNIT, ClutterParamSpecUnit))
@@ -156,7 +152,7 @@ typedef gint32 ClutterUnit;
*
* Since: 0.8
*/
-#define CLUTTER_MAXUNIT (0x7fffffff)
+#define CLUTTER_MAXUNIT (G_MAXFLOAT)
/**
* CLUTTER_MINUNIT:
@@ -165,7 +161,7 @@ typedef gint32 ClutterUnit;
*
* Since: 0.8
*/
-#define CLUTTER_MINUNIT (0x80000000)
+#define CLUTTER_MINUNIT (-G_MAXFLOAT)
/**
* CLUTTER_VALUE_HOLDS_UNIT: