diff --git a/clutter/clutter/clutter-private.h b/clutter/clutter/clutter-private.h index cbfaaa7f0..a5cd1fa19 100644 --- a/clutter/clutter/clutter-private.h +++ b/clutter/clutter/clutter-private.h @@ -249,6 +249,14 @@ void _clutter_util_fully_transform_vertices (const CoglMatrix *modelview, void _clutter_util_rect_from_rectangle (const cairo_rectangle_int_t *src, ClutterRect *dest); +void _clutter_util_rectangle_int_extents (const ClutterRect *src, + cairo_rectangle_int_t *dest); + +void _clutter_util_rectangle_offset (const cairo_rectangle_int_t *src, + int x, + int y, + cairo_rectangle_int_t *dest); + void _clutter_util_rectangle_union (const cairo_rectangle_int_t *src1, const cairo_rectangle_int_t *src2, cairo_rectangle_int_t *dest); diff --git a/clutter/clutter/clutter-util.c b/clutter/clutter/clutter-util.c index 49423e802..ed52b6977 100644 --- a/clutter/clutter/clutter-util.c +++ b/clutter/clutter/clutter-util.c @@ -120,6 +120,32 @@ void _clutter_util_rect_from_rectangle (const cairo_rectangle_int_t *src, }; } +void _clutter_util_rectangle_int_extents (const ClutterRect *src, + cairo_rectangle_int_t *dest) +{ + ClutterRect tmp = *src; + + clutter_rect_clamp_to_pixel (&tmp); + + *dest = (cairo_rectangle_int_t) { + .x = tmp.origin.x, + .y = tmp.origin.y, + .width = tmp.size.width, + .height = tmp.size.height, + }; +} + +void _clutter_util_rectangle_offset (const cairo_rectangle_int_t *src, + int x, + int y, + cairo_rectangle_int_t *dest) +{ + *dest = *src; + + dest->x += x; + dest->y += y; +} + /*< private > * _clutter_util_rectangle_union: * @src1: first rectangle to union