win: keep track of per-window damage

This is not used anywhere yet, but is intended for damage calculation
refactor.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2024-03-30 00:32:24 +00:00
parent 3cd107a29c
commit 9210536db1
No known key found for this signature in database
GPG Key ID: D3A4405BE6CC17F4
3 changed files with 13 additions and 2 deletions

View File

@ -704,11 +704,17 @@ static inline void repair_win(session_t *ps, struct managed_win *w) {
}
// Remove the part in the damage area that could be ignored
region_t without_ignored;
pixman_region32_init(&without_ignored);
if (w->reg_ignore && win_is_region_ignore_valid(ps, w)) {
pixman_region32_subtract(&parts, &parts, w->reg_ignore);
pixman_region32_subtract(&without_ignored, &parts, w->reg_ignore);
}
add_damage(ps, &parts);
add_damage(ps, &without_ignored);
pixman_region32_fini(&without_ignored);
pixman_region32_translate(&parts, -w->g.x, -w->g.y);
pixman_region32_copy(&w->damaged, &parts);
pixman_region32_fini(&parts);
}

View File

@ -1805,6 +1805,7 @@ struct win *attr_ret_nonnull maybe_allocate_managed_win(session_t *ps, struct wi
};
win_set_properties_stale(new, init_stale_props, ARR_SIZE(init_stale_props));
c2_window_state_init(ps->c2_state, &new->c2_state);
pixman_region32_init(&new->damaged);
return &new->base;
}
@ -2179,6 +2180,7 @@ void destroy_win_finish(session_t *ps, struct win *w) {
w2->prev_trans = NULL;
}
}
pixman_region32_fini(&mw->damaged);
}
free(w);

View File

@ -299,6 +299,9 @@ struct managed_win {
/// Background texture of the window
glx_texture_t *glx_texture_bg;
#endif
/// The damaged region of the window, in window local coordinates.
region_t damaged;
};
/// Process pending updates/images flags on a window. Has to be called in X critical