From 79b81263f4e07b1c025db0c73636f69fef5044d0 Mon Sep 17 00:00:00 2001 From: Jente Hidskes Date: Fri, 3 Jul 2020 21:55:19 +0200 Subject: [PATCH] output: add damage tracking methods --- desktop/output.c | 20 +++++++++++++++++++- desktop/output.h | 2 ++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/desktop/output.c b/desktop/output.c index 473034f..9eab6ac 100644 --- a/desktop/output.c +++ b/desktop/output.c @@ -30,6 +30,24 @@ #include "renderer.h" #include "view.h" +void +cage_output_damage_whole(struct cg_output *output) +{ + assert(output != NULL); + + wlr_output_damage_add_whole(output->damage); +} + +void +cage_output_damage_region(struct cg_output *output, struct wlr_box *region) +{ + assert(output != NULL); + assert(region != NULL); + assert(output->wlr_output->enabled); + + wlr_output_damage_add_box(output->damage, region); +} + struct send_frame_done_data { struct timespec when; }; @@ -184,7 +202,7 @@ cage_output_enable(struct cg_output *output) wlr_output_enable(wlr_output, true); wlr_output_commit(wlr_output); - wlr_output_damage_add_whole(output->damage); + cage_output_damage_whole(output); } void diff --git a/desktop/output.h b/desktop/output.h index ff54723..307f3f9 100644 --- a/desktop/output.h +++ b/desktop/output.h @@ -24,6 +24,8 @@ struct cg_output { struct wl_list link; // cg_server::outputs }; +void cage_output_damage_whole(struct cg_output *output); +void cage_output_damage_region(struct cg_output *output, struct wlr_box *region); void cage_output_get_geometry(struct cg_output *output, struct wlr_box *geometry); void cage_output_disable(struct cg_output *output); void cage_output_enable(struct cg_output *output);