backend: clarify comments about reg_paint

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2019-11-30 21:22:28 +00:00
parent d4e76b271a
commit 7040579a38
No known key found for this signature in database
GPG Key ID: 37C999F617EA1A47
1 changed files with 16 additions and 6 deletions

View File

@ -85,6 +85,16 @@ void paint_all_new(session_t *ps, struct managed_win *t, bool ignore_damage) {
static struct timespec last_paint = {0};
#endif
// <damage-note>
// If use_damage is enabled, we MUST make sure only the damaged regions of the
// screen are ever touched by the compositor. The reason is that at the beginning
// of each render, we clear the damaged regions with the wallpaper, and nothing
// else. If later during the render we changed anything outside the damaged
// region, that won't be cleared by the next render, and will thus accumulate.
// (e.g. if shadow is drawn outside the damaged region, it will become thicker and
// thicker over time.)
/// The adjusted damaged regions
region_t reg_paint;
assert(ps->o.blur_method != BLUR_METHOD_INVALID);
if (ps->o.blur_method != BLUR_METHOD_NONE && ps->backend_data->ops->get_blur_size) {
@ -266,8 +276,8 @@ void paint_all_new(session_t *ps, struct managed_win *t, bool ignore_damage) {
// Set max brightness
if (ps->o.max_brightness < 1.0) {
ps->backend_data->ops->image_op(
ps->backend_data, IMAGE_OP_MAX_BRIGHTNESS, w->win_image,
NULL, &reg_visible, &ps->o.max_brightness);
ps->backend_data, IMAGE_OP_MAX_BRIGHTNESS, w->win_image, NULL,
&reg_visible, &ps->o.max_brightness);
}
// Draw window on target
@ -279,9 +289,9 @@ void paint_all_new(session_t *ps, struct managed_win *t, bool ignore_damage) {
// We don't need to paint the window body itself if it's
// completely transparent.
// For window image processing, we don't need to limit the process
// region to damage, since the window image data is independent
// from the target image data, which we want to protect.
// For window image processing, we don't have to limit the process
// region to damage for correctness. (see <damager-note> for
// details)
// The bounding shape, in window local coordinates
region_t reg_bound_local;