diff --git a/clutter/clutter-base-types.c b/clutter/clutter-base-types.c index aefd16462..ff9e84567 100644 --- a/clutter/clutter-base-types.c +++ b/clutter/clutter-base-types.c @@ -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 diff --git a/clutter/clutter-types.h b/clutter/clutter-types.h index c9c3e0bd6..e6f8327fb 100644 --- a/clutter/clutter-types.h +++ b/clutter/clutter-types.h @@ -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); diff --git a/clutter/clutter.symbols b/clutter/clutter.symbols index 2349829d1..75a538850 100644 --- a/clutter/clutter.symbols +++ b/clutter/clutter.symbols @@ -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