diff options
author | Isaac Freund <ifreund@ifreund.xyz> | 2020-12-06 16:58:52 +0100 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2020-12-06 17:11:46 +0100 |
commit | 37cb3eb8ddbc264560757d538fe6710ac8784721 (patch) | |
tree | 13cae379003f2b4eddd0a19b770c461b14c54c53 | |
parent | 1ecc1b5987907f6fc32dcb3da5adf797bd498ef6 (diff) | |
download | wlroots-37cb3eb8ddbc264560757d538fe6710ac8784721.tar.xz |
screencopy: check if damage committed before copy
This check avoids copying stale state from output->pending.damage.
-rw-r--r-- | types/wlr_screencopy_v1.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/types/wlr_screencopy_v1.c b/types/wlr_screencopy_v1.c index 4444b8c0..b4d47fbd 100644 --- a/types/wlr_screencopy_v1.c +++ b/types/wlr_screencopy_v1.c @@ -51,15 +51,14 @@ static void screencopy_damage_accumulate(struct screencopy_damage *damage) { int width, height; wlr_output_transformed_resolution(output, &width, &height); - // If the compositor did not submit damage but did submit a buffer, - if (!(output->pending.committed & WLR_OUTPUT_STATE_DAMAGE) && - (output->pending.committed & WLR_OUTPUT_STATE_BUFFER)) { - // damage everything - pixman_region32_union_rect(region, region, 0, 0, width, height); - } else { - // otherwise copy over the current damage + if (output->pending.committed & WLR_OUTPUT_STATE_DAMAGE) { + // If the compositor submitted damage, copy it over pixman_region32_union(region, region, &output->pending.damage); pixman_region32_intersect_rect(region, region, 0, 0, width, height); + } else if (output->pending.committed & WLR_OUTPUT_STATE_BUFFER) { + // If the compositor did not submit damage but did submit a buffer + // damage everything + pixman_region32_union_rect(region, region, 0, 0, width, height); } damage->last_commit_seq = output->commit_seq; |