mirror of
https://github.com/brl/mutter.git
synced 2024-11-30 03:50:47 -05:00
2008-02-15 Tomas Frydrych <tf@openedhand.com>
* clutter/clutter-actor.c: * clutter/clutter-actor.h: (clutter_group_query_coords): Added function to translate vertex array to a bounding box. (clutter_actor_is_scaled): (clutter_actor_is_rotated): Fixed documentation.
This commit is contained in:
parent
4d53cb1037
commit
78341d2e28
11
ChangeLog
11
ChangeLog
@ -1,3 +1,14 @@
|
|||||||
|
2008-02-15 Tomas Frydrych <tf@openedhand.com>
|
||||||
|
|
||||||
|
* clutter/clutter-actor.c:
|
||||||
|
* clutter/clutter-actor.h:
|
||||||
|
(clutter_group_query_coords):
|
||||||
|
Added function to translate vertex array to a bounding box.
|
||||||
|
|
||||||
|
(clutter_actor_is_scaled):
|
||||||
|
(clutter_actor_is_rotated):
|
||||||
|
Fixed documentation.
|
||||||
|
|
||||||
2008-02-15 Tomas Frydrych <tf@openedhand.com>
|
2008-02-15 Tomas Frydrych <tf@openedhand.com>
|
||||||
|
|
||||||
* clutter/clutter-group.c: (clutter_group_query_coords):
|
* clutter/clutter-group.c: (clutter_group_query_coords):
|
||||||
|
@ -5520,7 +5520,9 @@ clutter_actor_set_shader_param (ClutterActor *self,
|
|||||||
* clutter_actor_is_rotated:
|
* clutter_actor_is_rotated:
|
||||||
* @self: a #ClutterActor
|
* @self: a #ClutterActor
|
||||||
*
|
*
|
||||||
* Returns true if any rotation is applied to the actor.
|
* Checks whether any rotation is applied to the actor.
|
||||||
|
*
|
||||||
|
* Return value: %TRUE if the actor is rotated.
|
||||||
*
|
*
|
||||||
* Since: 0.6
|
* Since: 0.6
|
||||||
*/
|
*/
|
||||||
@ -5543,7 +5545,9 @@ clutter_actor_is_rotated (ClutterActor *self)
|
|||||||
* clutter_actor_is_scaled:
|
* clutter_actor_is_scaled:
|
||||||
* @self: a #ClutterActor
|
* @self: a #ClutterActor
|
||||||
*
|
*
|
||||||
* Returns true if the actor is scaled in either dimension.
|
* Checks whether the actor is scaled in either dimension.
|
||||||
|
*
|
||||||
|
* Return value: %TRUE if the actor is scaled.
|
||||||
*
|
*
|
||||||
* Since: 0.6
|
* Since: 0.6
|
||||||
*/
|
*/
|
||||||
@ -5562,3 +5566,55 @@ clutter_actor_is_scaled (ClutterActor *self)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* clutter_actor_get_box_from_vertices:
|
||||||
|
* @vtx: array of four #ClutterVertex
|
||||||
|
* @box: pointer to #ClutterActorBox where to store the result
|
||||||
|
*
|
||||||
|
* Calculates the bounding box represented by the four vertices; for details
|
||||||
|
* of the vertex array see clutter_actor_get_vertices().
|
||||||
|
*
|
||||||
|
* Since: 0.6
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
clutter_actor_get_box_from_vertices (ClutterVertex vtx[4],
|
||||||
|
ClutterActorBox *box)
|
||||||
|
{
|
||||||
|
ClutterUnit x1, x2, y1, y2;
|
||||||
|
|
||||||
|
/* 4-way min/max */
|
||||||
|
x1 = vtx[0].x;
|
||||||
|
y1 = vtx[0].y;
|
||||||
|
if (vtx[1].x < x1)
|
||||||
|
x1 = vtx[1].x;
|
||||||
|
if (vtx[2].x < x1)
|
||||||
|
x1 = vtx[2].x;
|
||||||
|
if (vtx[3].x < x1)
|
||||||
|
x1 = vtx[3].x;
|
||||||
|
if (vtx[1].y < y1)
|
||||||
|
y1 = vtx[1].y;
|
||||||
|
if (vtx[2].y < y1)
|
||||||
|
y1 = vtx[2].y;
|
||||||
|
if (vtx[3].y < y1)
|
||||||
|
y1 = vtx[3].y;
|
||||||
|
|
||||||
|
x2 = vtx[0].x;
|
||||||
|
y2 = vtx[0].y;
|
||||||
|
if (vtx[1].x > x2)
|
||||||
|
x2 = vtx[1].x;
|
||||||
|
if (vtx[2].x > x2)
|
||||||
|
x2 = vtx[2].x;
|
||||||
|
if (vtx[3].x > x2)
|
||||||
|
x2 = vtx[3].x;
|
||||||
|
if (vtx[1].y > y2)
|
||||||
|
y2 = vtx[1].y;
|
||||||
|
if (vtx[2].y > y2)
|
||||||
|
y2 = vtx[2].y;
|
||||||
|
if (vtx[3].y > y2)
|
||||||
|
y2 = vtx[3].y;
|
||||||
|
|
||||||
|
box->x1 = x1;
|
||||||
|
box->x2 = x2;
|
||||||
|
box->y1 = y1;
|
||||||
|
box->y2 = y2;
|
||||||
|
}
|
||||||
|
@ -461,6 +461,9 @@ gboolean clutter_actor_transform_stage_point (ClutterActor *self,
|
|||||||
gboolean clutter_actor_is_rotated (ClutterActor *self);
|
gboolean clutter_actor_is_rotated (ClutterActor *self);
|
||||||
gboolean clutter_actor_is_scaled (ClutterActor *self);
|
gboolean clutter_actor_is_scaled (ClutterActor *self);
|
||||||
|
|
||||||
|
void clutter_actor_get_box_from_vertices (ClutterVertex vtx[4],
|
||||||
|
ClutterActorBox *box);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* _HAVE_CLUTTER_ACTOR_H */
|
#endif /* _HAVE_CLUTTER_ACTOR_H */
|
||||||
|
@ -148,49 +148,6 @@ clutter_group_request_coords (ClutterActor *self,
|
|||||||
CLUTTER_ACTOR_CLASS (clutter_group_parent_class)->request_coords (self, box);
|
CLUTTER_ACTOR_CLASS (clutter_group_parent_class)->request_coords (self, box);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
clutter_group_get_box_from_vertices (ClutterActorBox *box,
|
|
||||||
ClutterVertex vtx[4])
|
|
||||||
{
|
|
||||||
ClutterUnit x1, x2, y1, y2;
|
|
||||||
|
|
||||||
/* 4-way min/max */
|
|
||||||
x1 = vtx[0].x;
|
|
||||||
y1 = vtx[0].y;
|
|
||||||
if (vtx[1].x < x1)
|
|
||||||
x1 = vtx[1].x;
|
|
||||||
if (vtx[2].x < x1)
|
|
||||||
x1 = vtx[2].x;
|
|
||||||
if (vtx[3].x < x1)
|
|
||||||
x1 = vtx[3].x;
|
|
||||||
if (vtx[1].y < y1)
|
|
||||||
y1 = vtx[1].y;
|
|
||||||
if (vtx[2].y < y1)
|
|
||||||
y1 = vtx[2].y;
|
|
||||||
if (vtx[3].y < y1)
|
|
||||||
y1 = vtx[3].y;
|
|
||||||
|
|
||||||
x2 = vtx[0].x;
|
|
||||||
y2 = vtx[0].y;
|
|
||||||
if (vtx[1].x > x2)
|
|
||||||
x2 = vtx[1].x;
|
|
||||||
if (vtx[2].x > x2)
|
|
||||||
x2 = vtx[2].x;
|
|
||||||
if (vtx[3].x > x2)
|
|
||||||
x2 = vtx[3].x;
|
|
||||||
if (vtx[1].y > y2)
|
|
||||||
y2 = vtx[1].y;
|
|
||||||
if (vtx[2].y > y2)
|
|
||||||
y2 = vtx[2].y;
|
|
||||||
if (vtx[3].y > y2)
|
|
||||||
y2 = vtx[3].y;
|
|
||||||
|
|
||||||
box->x1 = x1;
|
|
||||||
box->x2 = x2;
|
|
||||||
box->y1 = y1;
|
|
||||||
box->y2 = y2;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_group_query_coords (ClutterActor *self,
|
clutter_group_query_coords (ClutterActor *self,
|
||||||
ClutterActorBox *box)
|
ClutterActorBox *box)
|
||||||
@ -220,7 +177,7 @@ clutter_group_query_coords (ClutterActor *self,
|
|||||||
ClutterVertex vtx[4];
|
ClutterVertex vtx[4];
|
||||||
|
|
||||||
clutter_actor_get_relative_vertices (child, self, vtx);
|
clutter_actor_get_relative_vertices (child, self, vtx);
|
||||||
clutter_group_get_box_from_vertices (&cbox, vtx);
|
clutter_actor_get_box_from_vertices (vtx, &cbox);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user