diff options
-rw-r--r-- | include/wlr/types/wlr_output_damage.h | 2 | ||||
-rw-r--r-- | types/wlr_output_damage.c | 14 |
2 files changed, 5 insertions, 11 deletions
diff --git a/include/wlr/types/wlr_output_damage.h b/include/wlr/types/wlr_output_damage.h index e7c609ed..ba5c88df 100644 --- a/include/wlr/types/wlr_output_damage.h +++ b/include/wlr/types/wlr_output_damage.h @@ -43,7 +43,7 @@ struct wlr_output_damage { pixman_region32_t previous[WLR_OUTPUT_DAMAGE_PREVIOUS_LEN]; size_t previous_idx; - enum wlr_output_state_buffer_type pending_buffer_type; + bool pending_attach_render; struct { struct wl_signal frame; diff --git a/types/wlr_output_damage.c b/types/wlr_output_damage.c index e49df016..3d5a99e3 100644 --- a/types/wlr_output_damage.c +++ b/types/wlr_output_damage.c @@ -52,11 +52,8 @@ static void output_handle_precommit(struct wl_listener *listener, void *data) { if (output->pending.committed & WLR_OUTPUT_STATE_BUFFER) { // TODO: find a better way to access this info without a precommit // handler - if (output->back_buffer != NULL) { - output_damage->pending_buffer_type = WLR_OUTPUT_STATE_BUFFER_RENDER; - } else { - output_damage->pending_buffer_type = output->pending.buffer_type; - } + output_damage->pending_attach_render = output->back_buffer != NULL || + output->pending.buffer_type == WLR_OUTPUT_STATE_BUFFER_RENDER; } } @@ -74,8 +71,7 @@ static void output_handle_commit(struct wl_listener *listener, void *data) { } pixman_region32_t *prev; - switch (output_damage->pending_buffer_type) { - case WLR_OUTPUT_STATE_BUFFER_RENDER: + if (output_damage->pending_attach_render) { // render-buffers have been swapped, rotate the damage // same as decrementing, but works on unsigned integers @@ -84,12 +80,10 @@ static void output_handle_commit(struct wl_listener *listener, void *data) { prev = &output_damage->previous[output_damage->previous_idx]; pixman_region32_copy(prev, &output_damage->current); - break; - case WLR_OUTPUT_STATE_BUFFER_SCANOUT: + } else { // accumulate render-buffer damage prev = &output_damage->previous[output_damage->previous_idx]; pixman_region32_union(prev, prev, &output_damage->current); - break; } pixman_region32_clear(&output_damage->current); |