|
|
|
@ -10,6 +10,14 @@
|
|
|
|
|
*/
|
|
|
|
|
#define WLR_OUTPUT_DAMAGE_PREVIOUS_LEN 2
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Tracks damage for an output.
|
|
|
|
|
*
|
|
|
|
|
* When a `frame` event is emitted, `wlr_output_damage_make_current` should be
|
|
|
|
|
* called. If necessary, the output should be repainted and
|
|
|
|
|
* `wlr_output_damage_swap_buffers` should be called. No rendering should happen
|
|
|
|
|
* outside a `frame` event handler.
|
|
|
|
|
*/
|
|
|
|
|
struct wlr_output_damage {
|
|
|
|
|
struct wlr_output *output;
|
|
|
|
|
|
|
|
|
@ -32,13 +40,33 @@ struct wlr_output_damage {
|
|
|
|
|
|
|
|
|
|
struct wlr_output_damage *wlr_output_damage_create(struct wlr_output *output);
|
|
|
|
|
void wlr_output_damage_destroy(struct wlr_output_damage *output_damage);
|
|
|
|
|
/**
|
|
|
|
|
* Makes the output rendering context current. `needs_swap` is set to true if
|
|
|
|
|
* `wlr_output_damage_swap_buffers` needs to be called. The region of the output
|
|
|
|
|
* that needs to be repainted is added to `damage`.
|
|
|
|
|
*/
|
|
|
|
|
bool wlr_output_damage_make_current(struct wlr_output_damage *output_damage,
|
|
|
|
|
bool *needs_swap, pixman_region32_t *damage);
|
|
|
|
|
/**
|
|
|
|
|
* Swaps the output buffers. If the time of the frame isn't known, set `when` to
|
|
|
|
|
* NULL.
|
|
|
|
|
*
|
|
|
|
|
* Swapping buffers schedules a `frame` event.
|
|
|
|
|
*/
|
|
|
|
|
bool wlr_output_damage_swap_buffers(struct wlr_output_damage *output_damage,
|
|
|
|
|
struct timespec *when, pixman_region32_t *damage);
|
|
|
|
|
/**
|
|
|
|
|
* Accumulates damage and schedules a `frame` event.
|
|
|
|
|
*/
|
|
|
|
|
void wlr_output_damage_add(struct wlr_output_damage *output_damage,
|
|
|
|
|
pixman_region32_t *damage);
|
|
|
|
|
/**
|
|
|
|
|
* Damages the whole output and schedules a `frame` event.
|
|
|
|
|
*/
|
|
|
|
|
void wlr_output_damage_add_whole(struct wlr_output_damage *output_damage);
|
|
|
|
|
/**
|
|
|
|
|
* Accumulates damage from a box and schedules a `frame` event.
|
|
|
|
|
*/
|
|
|
|
|
void wlr_output_damage_add_box(struct wlr_output_damage *output_damage,
|
|
|
|
|
struct wlr_box *box);
|
|
|
|
|
|
|
|
|
|