mirror of
https://github.com/brl/mutter.git
synced 2024-11-09 23:46:33 -05:00
clutter/util: Add functions for managing cairo and clutter rects
Utility functions to easily convert from ClutterRect to cairo int rects and vice-versa. And add ability to offset a cairo rect. https://gitlab.gnome.org/GNOME/mutter/merge_requests/3
This commit is contained in:
parent
a8c972cd6b
commit
e5a9e9c93b
@ -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);
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user