Use pre-multiplied colors by default

wlr_scene_rects expect their color to be pre-multiplied
while cairo_set_source_rgba() expects them to not be
pre-multiplied. With this patch we now use premultiplied
colors internally by default and then reverse it when
setting cairo colors.

This ensures the titlebar uses a consistent color in case
it was defined with some transparency by the user.

Fixes: #1684
This commit is contained in:
Consolatis 2024-04-06 17:46:30 +02:00
parent 33859138cf
commit c35ba02ffa
3 changed files with 20 additions and 4 deletions

View file

@ -16,7 +16,7 @@ create_overlay(struct seat *seat)
seat->overlay.tree = parent;
wlr_scene_node_set_enabled(&parent->node, false);
if (!wlr_renderer_is_pixman(server->renderer)) {
/* Hardware assisted rendering: Half transparent overlay */
/* Hardware assisted rendering: Half transparent overlay, pre-multiplied */
float color[4] = { 0.25, 0.25, 0.35, 0.5 };
seat->overlay.rect = wlr_scene_rect_create(parent, 0, 0, color);
} else {