mirror of https://github.com/yshui/picom.git
backend: xrender: force 32bit ARGB visual when adding rounded corners
Force the temporary picture to a 32-bit ARGB visual when masking it for rounded corners to keep the transparency information. Otherwise, windows with a 24-bit visual would get black corners instead. Authored-by: Bernd Busse <bernd@busse-net.de> Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
parent
e60cb65672
commit
fd9c52d0ee
|
@ -250,10 +250,16 @@ compose_impl(struct _xrender_data *xd, struct xrender_image *xrimg, coord_t dst,
|
||||||
}
|
}
|
||||||
if (((img->color_inverted || img->dim != 0) && has_alpha) || img->corner_radius != 0) {
|
if (((img->color_inverted || img->dim != 0) && has_alpha) || img->corner_radius != 0) {
|
||||||
// Apply image properties using a temporary image, because the source
|
// Apply image properties using a temporary image, because the source
|
||||||
// image is transparent. Otherwise the properties can be applied directly
|
// image is transparent or will get transparent corners. Otherwise the
|
||||||
// on the target image.
|
// properties can be applied directly on the target image.
|
||||||
|
// Also force a 32-bit ARGB visual for transparent corners, otherwise the
|
||||||
|
// corners become black.
|
||||||
|
auto visual =
|
||||||
|
(img->corner_radius != 0 && inner->depth != 32)
|
||||||
|
? x_get_visual_for_standard(xd->base.c, XCB_PICT_STANDARD_ARGB_32)
|
||||||
|
: inner->visual;
|
||||||
auto tmp_pict = x_create_picture_with_visual(
|
auto tmp_pict = x_create_picture_with_visual(
|
||||||
xd->base.c, inner->width, inner->height, inner->visual, 0, NULL);
|
xd->base.c, inner->width, inner->height, visual, 0, NULL);
|
||||||
|
|
||||||
// Set clip region translated to source coordinate
|
// Set clip region translated to source coordinate
|
||||||
x_set_picture_clip_region(xd->base.c, tmp_pict, to_i16_checked(-dst.x),
|
x_set_picture_clip_region(xd->base.c, tmp_pict, to_i16_checked(-dst.x),
|
||||||
|
|
Loading…
Reference in New Issue