From 49ccd7f78648e406ae0ec3b9fbf243a62bbd7770 Mon Sep 17 00:00:00 2001 From: Derek Foreman Date: Wed, 2 Aug 2023 11:40:26 -0500 Subject: [PATCH] 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 --- include/libweston/matrix.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/libweston/matrix.h b/include/libweston/matrix.h index 2bee61fa4..a77cb2cad 100644 --- a/include/libweston/matrix.h +++ b/include/libweston/matrix.h @@ -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