wlr_damage_ring: Introduce wlr_damage_ring_damage_for_buffer

This cannot be used along with `wlr_damage_ring_get_buffer_damage` in
the same damage ring.
This commit is contained in:
Alexander Orzechowski 2023-07-14 03:03:38 -04:00 committed by Leo Li
parent 600d995e94
commit a6676e81ed
2 changed files with 93 additions and 0 deletions

View file

@ -16,10 +16,15 @@
#include <wayland-server-core.h>
struct wlr_box;
struct wlr_buffer;
struct wlr_damage_ring_entry {
pixman_region32_t damage;
struct wlr_buffer *buffer;
struct wl_listener buffer_destroy;
struct wlr_damage_ring *ring;
struct wl_list link; // struct wlr_damage_ring.previous
};
@ -84,4 +89,14 @@ void wlr_damage_ring_rotate(struct wlr_damage_ring *ring);
void wlr_damage_ring_get_buffer_damage(struct wlr_damage_ring *ring,
int buffer_age, pixman_region32_t *damage);
/**
* Get the since accumulated damage for this buffer. These buffers should
* typically come from a wlr_swapchain. In the context of rendering, the
* damage is the region that needs to be redrawn.
*
* The damage ring is automatically rotated during invocation.
*/
void wlr_damage_ring_damage_for_buffer(struct wlr_damage_ring *ring,
struct wlr_buffer *buffer, pixman_region32_t *damage);
#endif