matrix: add weston_coord_surface_invert()

Simple helper to multiply a surface coordinate by -1, -1. There are no
uses yet, but will be in a follow up patch that wants to have cursor
hotspots in their inverted form.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This commit is contained in:
Derek Foreman 2023-08-02 11:40:26 -05:00 committed by Marius Vlad
parent b87dcbdf34
commit 49ccd7f786

View file

@ -186,6 +186,17 @@ weston_coord_truncate(struct weston_coord in)
return (struct weston_coord){ (int)in.x, (int)in.y };
}
static inline struct weston_coord_surface __attribute__ ((warn_unused_result))
weston_coord_surface_invert(struct weston_coord_surface in)
{
struct weston_coord_surface out = in;
out.c.x = -out.c.x;
out.c.y = -out.c.y;
return out;
}
#ifdef __cplusplus
}
#endif