backend: fix rendering shadow with opacity
Shadow opacity should be multiplied with the window's opacity. Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
@ -134,9 +134,21 @@ void paint_all_new(session_t *ps, win *const t, bool ignore_damage) {
|
||||
}
|
||||
|
||||
assert(w->shadow_image);
|
||||
ps->backend_data->ops->compose(
|
||||
ps->backend_data, w->shadow_image, w->g.x + w->shadow_dx,
|
||||
w->g.y + w->shadow_dy, ®_shadow, ®_visible);
|
||||
if (w->opacity == 1) {
|
||||
ps->backend_data->ops->compose(
|
||||
ps->backend_data, w->shadow_image, w->g.x + w->shadow_dx,
|
||||
w->g.y + w->shadow_dy, ®_shadow, ®_visible);
|
||||
} else {
|
||||
auto new_img = ps->backend_data->ops->copy(
|
||||
ps->backend_data, w->shadow_image, ®_visible);
|
||||
ps->backend_data->ops->image_op(
|
||||
ps->backend_data, IMAGE_OP_APPLY_ALPHA_ALL, new_img,
|
||||
NULL, ®_visible, (double[]){w->opacity});
|
||||
ps->backend_data->ops->compose(
|
||||
ps->backend_data, new_img, w->g.x + w->shadow_dx,
|
||||
w->g.y + w->shadow_dy, ®_shadow, ®_visible);
|
||||
ps->backend_data->ops->release_image(ps->backend_data, new_img);
|
||||
}
|
||||
pixman_region32_fini(®_shadow);
|
||||
}
|
||||
|
||||
@ -244,8 +256,7 @@ void paint_all_new(session_t *ps, win *const t, bool ignore_damage) {
|
||||
|
||||
if (ps->o.monitor_repaint) {
|
||||
reg_damage = get_damage(ps, false);
|
||||
ps->backend_data->ops->fill(
|
||||
ps->backend_data, 0.5, 0, 0, 0.5, ®_damage);
|
||||
ps->backend_data->ops->fill(ps->backend_data, 0.5, 0, 0, 0.5, ®_damage);
|
||||
pixman_region32_fini(®_damage);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user