From ece2c1e4e200192bde19a2590b5a31f244e09524 Mon Sep 17 00:00:00 2001 From: emersion Date: Fri, 26 Jan 2018 22:11:09 +0100 Subject: Damage tracking for transformed outputs --- include/rootston/output.h | 4 ++-- include/wlr/types/wlr_box.h | 8 ++++++-- include/wlr/types/wlr_output.h | 3 ++- include/wlr/util/region.h | 7 +++++++ 4 files changed, 17 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/include/rootston/output.h b/include/rootston/output.h index 81f20788..11f53d83 100644 --- a/include/rootston/output.h +++ b/include/rootston/output.h @@ -7,7 +7,7 @@ /** * Damage tracking requires to keep track of previous frames' damage. To allow - * damage tracking to work with triple buffering, an history of two frames is + * damage tracking to work with triple buffering, a history of two frames is * required. */ #define ROOTS_OUTPUT_PREVIOUS_DAMAGE_LEN 2 @@ -22,7 +22,7 @@ struct roots_output { struct roots_view *fullscreen_view; struct timespec last_frame; - pixman_region32_t damage; + pixman_region32_t damage; // in ouput-local coordinates bool frame_pending; // circular queue for previous damage diff --git a/include/wlr/types/wlr_box.h b/include/wlr/types/wlr_box.h index 0588201c..d6cc3509 100644 --- a/include/wlr/types/wlr_box.h +++ b/include/wlr/types/wlr_box.h @@ -2,6 +2,7 @@ #define WLR_TYPES_WLR_BOX_H #include +#include struct wlr_box { int x, y; @@ -18,8 +19,11 @@ bool wlr_box_contains_point(const struct wlr_box *box, double x, double y); bool wlr_box_empty(const struct wlr_box *box); -enum wl_output_transform; +/** + * Transforms a box inside a `width` x `height` box. + */ void wlr_box_transform(const struct wlr_box *box, - enum wl_output_transform transform, struct wlr_box *dest); + enum wl_output_transform transform, int width, int height, + struct wlr_box *dest); #endif diff --git a/include/wlr/types/wlr_output.h b/include/wlr/types/wlr_output.h index 823c3b5e..4eefbf55 100644 --- a/include/wlr/types/wlr_output.h +++ b/include/wlr/types/wlr_output.h @@ -61,7 +61,8 @@ struct wlr_output { enum wl_output_transform transform; bool needs_swap; - pixman_region32_t damage; // damage for cursors and fullscreen surface + // damage for cursors and fullscreen surface, in output-local coordinates + pixman_region32_t damage; float transform_matrix[16]; struct { diff --git a/include/wlr/util/region.h b/include/wlr/util/region.h index e268436b..5d2b37e1 100644 --- a/include/wlr/util/region.h +++ b/include/wlr/util/region.h @@ -2,6 +2,7 @@ #define WLR_UTIL_REGION_H #include +#include /** * Scales a region, ie. multiplies all its coordinates by `scale`. @@ -12,4 +13,10 @@ void wlr_region_scale(pixman_region32_t *dst, pixman_region32_t *src, float scale); +/** + * Applies a transform to a region inside a box of size `width` x `height`. + */ +void wlr_region_transform(pixman_region32_t *dst, pixman_region32_t *src, + enum wl_output_transform transform, int width, int height); + #endif -- cgit v1.2.3