Add a rect-contains-rect function

Similar to the contains-point one.
This commit is contained in:
Emmanuele Bassi 2012-04-19 12:32:07 +01:00
parent 9c637ccb41
commit b2feb463bd
3 changed files with 31 additions and 0 deletions

View File

@ -909,6 +909,34 @@ clutter_rect_contains_point (ClutterRect *rect,
(point->y <= (rect->origin.y + rect->size.height));
}
/**
* clutter_rect_contains_rect:
* @a: a #ClutterRect
* @b: a #ClutterRect
*
* Checks whether @a contains @b.
*
* The first rectangle contains the second if the union of the
* two #ClutterRect is equal to the first rectangle.
*
* Return value: %TRUE if the first rectangle contains the second.
*
* Since: 1.12
*/
gboolean
clutter_rect_contains_rect (ClutterRect *a,
ClutterRect *b)
{
ClutterRect res;
g_return_val_if_fail (a != NULL, FALSE);
g_return_val_if_fail (b != NULL, FALSE);
clutter_rect_union (a, b, &res);
return clutter_rect_equals (a, &res);
}
/**
* clutter_rect_union:
* @a: a #ClutterRect

View File

@ -221,6 +221,8 @@ void clutter_rect_get_center (ClutterRect *rect,
ClutterPoint *center);
gboolean clutter_rect_contains_point (ClutterRect *rect,
ClutterPoint *point);
gboolean clutter_rect_contains_rect (ClutterRect *a,
ClutterRect *b);
void clutter_rect_union (ClutterRect *a,
ClutterRect *b,
ClutterRect *res);

View File

@ -998,6 +998,7 @@ clutter_property_transition_set_property_name
clutter_rect_alloc
clutter_rect_clamp_to_pixel
clutter_rect_contains_point
clutter_rect_contains_rect
clutter_rect_copy
clutter_rect_equals
clutter_rect_free