output: restrict provided damage to output bounds
This commit is contained in:
parent
4cc58288cb
commit
2cc989e097
|
@ -474,14 +474,16 @@ bool wlr_output_swap_buffers(struct wlr_output *output, struct timespec *when,
|
||||||
pixman_region32_t *damage) {
|
pixman_region32_t *damage) {
|
||||||
wl_signal_emit(&output->events.swap_buffers, damage);
|
wl_signal_emit(&output->events.swap_buffers, damage);
|
||||||
|
|
||||||
pixman_region32_t *render_damage = damage;
|
int width, height;
|
||||||
if (damage == NULL) {
|
output_get_transformed_size(output, &width, &height);
|
||||||
// Damage tracking not supported, repaint the whole output
|
|
||||||
pixman_region32_t output_damage;
|
pixman_region32_t render_damage;
|
||||||
pixman_region32_init(&output_damage);
|
pixman_region32_init(&render_damage);
|
||||||
pixman_region32_union_rect(&output_damage, &output_damage,
|
pixman_region32_union_rect(&render_damage, &render_damage, 0, 0,
|
||||||
0, 0, output->width, output->height);
|
width, height);
|
||||||
render_damage = &output_damage;
|
if (damage != NULL) {
|
||||||
|
// Damage tracking supported
|
||||||
|
pixman_region32_intersect(&render_damage, &render_damage, damage);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (when == NULL) {
|
if (when == NULL) {
|
||||||
|
@ -490,10 +492,10 @@ bool wlr_output_swap_buffers(struct wlr_output *output, struct timespec *when,
|
||||||
when = &now;
|
when = &now;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pixman_region32_not_empty(render_damage)) {
|
if (pixman_region32_not_empty(&render_damage)) {
|
||||||
if (output->fullscreen_surface != NULL) {
|
if (output->fullscreen_surface != NULL) {
|
||||||
output_fullscreen_surface_render(output, output->fullscreen_surface,
|
output_fullscreen_surface_render(output, output->fullscreen_surface,
|
||||||
when, render_damage);
|
when, &render_damage);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_output_cursor *cursor;
|
struct wlr_output_cursor *cursor;
|
||||||
|
@ -502,7 +504,7 @@ bool wlr_output_swap_buffers(struct wlr_output *output, struct timespec *when,
|
||||||
output->hardware_cursor == cursor) {
|
output->hardware_cursor == cursor) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
output_cursor_render(cursor, when, render_damage);
|
output_cursor_render(cursor, when, &render_damage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -515,10 +517,7 @@ bool wlr_output_swap_buffers(struct wlr_output *output, struct timespec *when,
|
||||||
output->needs_swap = false;
|
output->needs_swap = false;
|
||||||
pixman_region32_clear(&output->damage);
|
pixman_region32_clear(&output->damage);
|
||||||
|
|
||||||
if (damage == NULL) {
|
pixman_region32_fini(&render_damage);
|
||||||
pixman_region32_fini(render_damage);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue