Additional blur artifact fix
There were still some artifacts left when multiple semi-transparent windows are stacked on top of each other. Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
parent
0109fe181e
commit
e3b93a4f84
|
@ -77,21 +77,29 @@ void paint_all_new(session_t *ps, struct managed_win *t, bool ignore_damage) {
|
||||||
int blur_width, blur_height;
|
int blur_width, blur_height;
|
||||||
ps->backend_data->ops->get_blur_size(ps->backend_blur_context,
|
ps->backend_data->ops->get_blur_size(ps->backend_blur_context,
|
||||||
&blur_width, &blur_height);
|
&blur_width, &blur_height);
|
||||||
if (t) {
|
|
||||||
// The region of screen a given window influences will be smeared
|
// The region of screen a given window influences will be smeared
|
||||||
// out by blur. With more windows on top of the given window, the
|
// out by blur. With more windows on top of the given window, the
|
||||||
// influences region will be smeared out more.
|
// influences region will be smeared out more.
|
||||||
//
|
//
|
||||||
|
// Also, blurring requires data slightly outside the area that needs
|
||||||
|
// to be blurred. The more semi-transparent windows are stacked on top
|
||||||
|
// of each other, the larger the area will be.
|
||||||
|
//
|
||||||
// Instead of accurately calculate how much bigger the damage
|
// Instead of accurately calculate how much bigger the damage
|
||||||
// region will be because of blur, we assume the worst case here.
|
// region will be because of blur, we assume the worst case here.
|
||||||
// That is, the damaged window is at the bottom of the stack, and
|
// That is, the damaged window is at the bottom of the stack, and
|
||||||
// all other windows have semi-transparent background
|
// all other windows have semi-transparent background
|
||||||
resize_region_in_place(®_damage, blur_width * t->stacking_rank,
|
int resize_factor = 1;
|
||||||
blur_height * t->stacking_rank);
|
if (t) {
|
||||||
pixman_region32_intersect(®_damage, ®_damage, &ps->screen_reg);
|
resize_factor = t->stacking_rank;
|
||||||
}
|
}
|
||||||
reg_paint = resize_region(®_damage, blur_width, blur_height);
|
resize_region_in_place(®_damage, blur_width * resize_factor,
|
||||||
|
blur_height * resize_factor);
|
||||||
|
reg_paint = resize_region(®_damage, blur_width * resize_factor,
|
||||||
|
blur_height * resize_factor);
|
||||||
pixman_region32_intersect(®_paint, ®_paint, &ps->screen_reg);
|
pixman_region32_intersect(®_paint, ®_paint, &ps->screen_reg);
|
||||||
|
pixman_region32_intersect(®_damage, ®_damage, &ps->screen_reg);
|
||||||
} else {
|
} else {
|
||||||
pixman_region32_init(®_paint);
|
pixman_region32_init(®_paint);
|
||||||
pixman_region32_copy(®_paint, ®_damage);
|
pixman_region32_copy(®_paint, ®_damage);
|
||||||
|
|
Loading…
Reference in New Issue