diff options
author | Alexander Orzechowski <alex@ozal.ski> | 2023-06-09 05:39:48 -0400 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2023-06-12 14:12:47 +0200 |
commit | ae7bad86dd04133037e62e670ff2c6999c19f315 (patch) | |
tree | a1f6d80fb61ba09dd02ab595a775a15fd2b6b514 | |
parent | 709c9dd2872859fb4f06c4384afea3385a8bb79b (diff) |
output: introduce wlr_output_state_set_damage()
-rw-r--r-- | include/wlr/types/wlr_output.h | 7 | ||||
-rw-r--r-- | types/output/state.c | 12 |
2 files changed, 19 insertions, 0 deletions
diff --git a/include/wlr/types/wlr_output.h b/include/wlr/types/wlr_output.h index 93943f0d..3ca8863a 100644 --- a/include/wlr/types/wlr_output.h +++ b/include/wlr/types/wlr_output.h @@ -573,6 +573,13 @@ void wlr_output_state_set_buffer(struct wlr_output_state *state, struct wlr_buffer *buffer); bool wlr_output_state_set_gamma_lut(struct wlr_output_state *state, size_t ramp_size, const uint16_t *r, const uint16_t *g, const uint16_t *b); +/** + * Sets the state's damage region. + * + * This should be called in along with wlr_output_state_set_buffer(). + */ +void wlr_output_state_set_damage(struct wlr_output_state *state, + const pixman_region32_t *damage); /** diff --git a/types/output/state.c b/types/output/state.c index cbbdc5c0..0bb384a8 100644 --- a/types/output/state.c +++ b/types/output/state.c @@ -76,6 +76,18 @@ void wlr_output_state_set_buffer(struct wlr_output_state *state, state->buffer = wlr_buffer_lock(buffer); } +void wlr_output_state_set_damage(struct wlr_output_state *state, + const pixman_region32_t *damage) { + if (state->committed & WLR_OUTPUT_STATE_DAMAGE) { + pixman_region32_fini(&state->damage); + } + + state->committed |= WLR_OUTPUT_STATE_DAMAGE; + + pixman_region32_init(&state->damage); + pixman_region32_copy(&state->damage, damage); +} + bool wlr_output_state_set_gamma_lut(struct wlr_output_state *state, size_t ramp_size, const uint16_t *r, const uint16_t *g, const uint16_t *b) { uint16_t *gamma_lut = NULL; |