ClutterVertex *vertex)
{
ClutterFixed v[4];
- ClutterFixed x, y, z, w;
+ ClutterUnit x, y, z, w;
+ fixed_vertex_t tmp;
g_return_if_fail (CLUTTER_IS_ACTOR (self));
g_return_if_fail (ancestor == NULL || CLUTTER_IS_ACTOR (ancestor));
w = COGL_FIXED_1;
/* First we tranform the point using the OpenGL modelview matrix */
- clutter_actor_transform_point_relative (self, ancestor,
- &x, &y, &z, &w);
+ clutter_actor_transform_point_relative (self, ancestor, &x, &y, &z, &w);
cogl_get_viewport (v);
* The w[3] parameter should always be 1.0 here, so we ignore it; otherwise
* we would have to divide the original verts with it.
*/
- vertex->x =
- CLUTTER_UNITS_FROM_FIXED (COGL_FIXED_MUL ((x + COGL_FIXED_0_5), v[2]));
- vertex->y =
- CLUTTER_UNITS_FROM_FIXED (COGL_FIXED_MUL ((COGL_FIXED_0_5 - y), v[3]));
- vertex->z =
- CLUTTER_UNITS_FROM_FIXED (COGL_FIXED_MUL ((z + COGL_FIXED_0_5), v[2]));
+ tmp.x = COGL_FIXED_MUL (CLUTTER_UNITS_TO_FIXED (x) + COGL_FIXED_0_5, v[2]);
+ tmp.y = COGL_FIXED_MUL (COGL_FIXED_0_5 - CLUTTER_UNITS_TO_FIXED (y), v[3]);
+ tmp.z = COGL_FIXED_MUL (CLUTTER_UNITS_TO_FIXED (z) + COGL_FIXED_0_5, v[2]);
+ tmp.w = 0;
+
+ fixed_vertex_to_units (&tmp, vertex);
}
/**
const ClutterVertex *point,
ClutterVertex *vertex)
{
+ ClutterUnit x, y, z, w;
ClutterFixed mtx_p[16];
ClutterFixed v[4];
fixed_vertex_t tmp = { 0, };
g_return_if_fail (point != NULL);
g_return_if_fail (vertex != NULL);
- tmp.x = CLUTTER_UNITS_TO_FIXED (vertex->x);
- tmp.y = CLUTTER_UNITS_TO_FIXED (vertex->y);
- tmp.z = CLUTTER_UNITS_TO_FIXED (vertex->z);
- tmp.w = COGL_FIXED_1;
+ x = point->x;
+ y = point->y;
+ z = point->z;
+ w = CLUTTER_UNITS_FROM_INT (1);
/* First we tranform the point using the OpenGL modelview matrix */
- clutter_actor_transform_point (self, &tmp.x, &tmp.y, &tmp.z, &tmp.w);
+ clutter_actor_transform_point (self, &x, &y, &z, &w);
+
+ tmp.x = CLUTTER_UNITS_TO_FIXED (x);
+ tmp.y = CLUTTER_UNITS_TO_FIXED (y);
+ tmp.z = CLUTTER_UNITS_TO_FIXED (z);
+ tmp.w = CLUTTER_UNITS_TO_FIXED (w);
cogl_get_projection_matrix (mtx_p);
cogl_get_viewport (v);
if (natural_width < min_width)
{
- g_warning ("Actor of type %s reported a natural width of %d (%d px) "
- "lower than min width %d (%d px)",
+ g_warning ("Actor of type %s reported a natural width "
+ "of %" CLUTTER_UNITS_FORMAT " (%d px) lower "
+ "than min width %" CLUTTER_UNITS_FORMAT " (%d px)",
G_OBJECT_TYPE_NAME (self),
natural_width, CLUTTER_UNITS_TO_DEVICE (natural_width),
min_width, CLUTTER_UNITS_TO_DEVICE (min_width));
if (natural_height < min_height)
{
- g_warning ("Actor of type %s reported a natural height of %d "
- "(%d px) lower than min height %d (%d px)",
+ g_warning ("Actor of type %s reported a natural height "
+ "of %" CLUTTER_UNITS_FORMAT " (%d px) lower than "
+ "min height %" CLUTTER_UNITS_FORMAT " (%d px)",
G_OBJECT_TYPE_NAME (self),
natural_height, CLUTTER_UNITS_TO_DEVICE (natural_height),
min_height, CLUTTER_UNITS_TO_DEVICE (min_height));
clutter_actor_set_position (p[i], 0, 0);
clutter_group_add (CLUTTER_GROUP (main_stage), p[i]);
- clutter_actor_set_position (p[i],
- CLUTTER_FIXED_TO_INT (v[i].x) -
- clutter_actor_get_width (p[i])/2,
- CLUTTER_FIXED_TO_INT (v[i].y) -
- clutter_actor_get_height (p[i])/2);
+ clutter_actor_set_positionu (p[i],
+ v[i].x -
+ clutter_actor_get_widthu (p[i])/2,
+ v[i].y -
+ clutter_actor_get_heightu (p[i])/2);
clutter_actor_raise_top (p[i]);
clutter_actor_show (p[i]);
}
- v1.x = CLUTTER_INT_TO_FIXED (clutter_actor_get_width (rect)/2);
- v1.y = CLUTTER_INT_TO_FIXED (clutter_actor_get_height (rect)/2);
+ v1.x = clutter_actor_get_widthu (rect) / 2;
+ v1.y = clutter_actor_get_heightu (rect) / 2;
v1.z = 0;
clutter_actor_apply_transform_to_point (rect, &v1, &v2);
clutter_actor_set_size (p[4], 5, 5);
clutter_actor_set_position (p[4], 0, 0);
clutter_group_add (CLUTTER_GROUP (main_stage), p[4]);
- clutter_actor_set_position (p[4],
- CLUTTER_FIXED_TO_INT (v2.x) -
- clutter_actor_get_width (p[4])/2,
- CLUTTER_FIXED_TO_INT (v2.y) -
- clutter_actor_get_height (p[4])/2);
+ clutter_actor_set_positionu (p[4],
+ v2.x -
+ clutter_actor_get_widthu (p[4])/2,
+ v2.y -
+ clutter_actor_get_heightu (p[4])/2);
clutter_actor_raise_top (p[4]);
clutter_actor_get_abs_allocation_vertices (rect, v);
for (i = 0; i < 4; ++i)
{
- clutter_actor_set_position (p[i],
- CLUTTER_FIXED_TO_INT (v[i].x) -
- clutter_actor_get_width (p[i])/2,
- CLUTTER_FIXED_TO_INT (v[i].y) -
- clutter_actor_get_height (p[i])/2);
+ clutter_actor_set_positionu (p[i],
+ v[i].x -
+ clutter_actor_get_widthu (p[i])/2,
+ v[i].y -
+ clutter_actor_get_heightu (p[i])/2);
}
- v1.x = CLUTTER_INT_TO_FIXED (clutter_actor_get_width (rect)/2);
- v1.y = CLUTTER_INT_TO_FIXED (clutter_actor_get_height (rect)/2);
+ v1.x = clutter_actor_get_widthu (rect)/2;
+ v1.y = clutter_actor_get_heightu (rect)/2;
v1.z = 0;
clutter_actor_apply_transform_to_point (rect, &v1, &v2);
- clutter_actor_set_position (p[4],
- CLUTTER_FIXED_TO_INT (v2.x) -
- clutter_actor_get_width (p[4])/2,
- CLUTTER_FIXED_TO_INT (v2.y) -
- clutter_actor_get_height (p[4])/2);
+ clutter_actor_set_positionu (p[4],
+ v2.x - clutter_actor_get_widthu (p[4])/2,
+ v2.y - clutter_actor_get_heightu (p[4])/2);
}
#define M(m,row,col) (m)[col*4+row]
gint x, y;
gint i;
ClutterActorBox box1, box2;
- ClutterFixed xp, yp;
+ ClutterUnit xp, yp;
i = find_handle_index (dragging);
clutter_actor_get_allocation_box (dragging, &box1);
clutter_actor_get_allocation_box (rect, &box2);
- xp = CLUTTER_INT_TO_FIXED (x-3) - box1.x1;
- yp = CLUTTER_INT_TO_FIXED (y-3) - box1.y1;
+ xp = CLUTTER_UNITS_FROM_DEVICE (x - 3) - box1.x1;
+ yp = CLUTTER_UNITS_FROM_DEVICE (y - 3) - box1.y1;
if (i == 4)
{
g_debug ("moving box by %f, %f",
- CLUTTER_FIXED_TO_FLOAT (xp),
- CLUTTER_FIXED_TO_FLOAT (yp));
+ CLUTTER_UNITS_TO_FLOAT (xp),
+ CLUTTER_UNITS_TO_FLOAT (yp));
- clutter_actor_move_by (rect,
- CLUTTER_FIXED_TO_INT(xp),
- CLUTTER_FIXED_TO_INT(yp));
+ clutter_actor_move_byu (rect, xp, yp);
}
else
{
g_debug ("adjusting box by %f, %f, handle %d",
- CLUTTER_FIXED_TO_FLOAT (xp),
- CLUTTER_FIXED_TO_FLOAT (yp),
+ CLUTTER_UNITS_TO_FLOAT (xp),
+ CLUTTER_UNITS_TO_FLOAT (yp),
i);
+
switch (i)
{
case 0: