libweston: Add a new helper to check if the view spawns the entire
output
Helpful to determine if the view can go through the scanout or not.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
diff --git a/libweston/compositor.c b/libweston/compositor.c
index 794253f..55f43af 100644
--- a/libweston/compositor.c
+++ b/libweston/compositor.c
@@ -1864,6 +1864,29 @@
return ev->surface->buffer_ref.buffer != NULL;
}
+/** Check if the view matches the entire output
+ *
+ * @param ev The view to check.
+ * @param output The output to check against.
+ *
+ * Returns true if the view does indeed matches the entire output.
+ */
+WL_EXPORT bool
+weston_view_matches_output_entirely(struct weston_view *ev,
+ struct weston_output *output)
+{
+ pixman_box32_t *extents =
+ pixman_region32_extents(&ev->transform.boundingbox);
+
+ if (extents->x1 != output->x ||
+ extents->y1 != output->y ||
+ extents->x2 != output->x + output->width ||
+ extents->y2 != output->y + output->height)
+ return false;
+
+ return true;
+}
+
/* Check if a surface has a view assigned to it
*
* The indicator is set manually when mapping