clutter/util: Add function to build a ClutterRect from a cairo rectangle

Utility functions to easily convert a cairo rectangle into a ClutterRect.

And add ability to offset a cairo rect.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/3
This commit is contained in:
Marco Trevisan (Treviño) 2019-03-01 15:43:14 +01:00 committed by Marco Trevisan
parent 3512647419
commit 789a3ef029
2 changed files with 18 additions and 0 deletions

View File

@ -241,6 +241,9 @@ void _clutter_util_fully_transform_vertices (const CoglMatrix *modelview,
ClutterVertex *vertices_out,
int n_vertices);
void _clutter_util_rect_from_rectangle (const cairo_rectangle_int_t *src,
ClutterRect *dest);
void _clutter_util_rectangle_union (const cairo_rectangle_int_t *src1,
const cairo_rectangle_int_t *src2,
cairo_rectangle_int_t *dest);

View File

@ -105,6 +105,21 @@ _clutter_util_fully_transform_vertices (const CoglMatrix *modelview,
}
}
void _clutter_util_rect_from_rectangle (const cairo_rectangle_int_t *src,
ClutterRect *dest)
{
*dest = (ClutterRect) {
.origin = {
.x = src->x,
.y = src->y
},
.size = {
.width = src->width,
.height = src->height
}
};
}
/*< private >
* _clutter_util_rectangle_union:
* @src1: first rectangle to union