From d14753e80c76ea297e641ff139329fb53ba75493 Mon Sep 17 00:00:00 2001 From: Derek Foreman Date: Thu, 27 Jan 2022 11:29:50 -0600 Subject: [PATCH] libweston: Add function to create a view's buffer to output matrix This can be helpful in testing if a paint node needs linear vs nearest neighbour filtering, or if a view can be placed on a plane. Signed-off-by: Derek Foreman --- libweston/compositor.c | 10 ++++++++++ libweston/libweston-internal.h | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/libweston/compositor.c b/libweston/compositor.c index 69d101c0c..6fbe3c626 100644 --- a/libweston/compositor.c +++ b/libweston/compositor.c @@ -810,6 +810,16 @@ weston_surface_to_buffer_region(struct weston_surface *surface, free(dest_rects); } +WL_EXPORT void +weston_view_buffer_to_output_matrix(const struct weston_view *view, + const struct weston_output *output, + struct weston_matrix *matrix) +{ + *matrix = view->surface->buffer_to_surface_matrix; + weston_matrix_multiply(matrix, &view->transform.matrix); + weston_matrix_multiply(matrix, &output->matrix); +} + WL_EXPORT void weston_view_move_to_plane(struct weston_view *view, struct weston_plane *plane) diff --git a/libweston/libweston-internal.h b/libweston/libweston-internal.h index b47e918c9..c0bb2d771 100644 --- a/libweston/libweston-internal.h +++ b/libweston/libweston-internal.h @@ -367,6 +367,10 @@ weston_view_takes_input_at_point(struct weston_view *view, int x, int y); void weston_view_move_to_plane(struct weston_view *view, struct weston_plane *plane); +void +weston_view_buffer_to_output_matrix(const struct weston_view *view, + const struct weston_output *output, + struct weston_matrix *matrix); pixman_box32_t weston_matrix_transform_rect(struct weston_matrix *matrix,