diff options
author | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-05-21 08:29:52 +1000 |
---|---|---|
committer | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-05-21 20:16:56 +1000 |
commit | 048b29527b8b0ec9c6cd9d0439b74bf73f4f6e2d (patch) | |
tree | 68210775c09209884b46b5866ca1b4530ca24324 /sway | |
parent | Add left/right borders to tabs (diff) | |
download | sway-048b29527b8b0ec9c6cd9d0439b74bf73f4f6e2d.tar.gz sway-048b29527b8b0ec9c6cd9d0439b74bf73f4f6e2d.tar.zst sway-048b29527b8b0ec9c6cd9d0439b74bf73f4f6e2d.zip |
Pre-multiply alpha for tab decorations
Diffstat (limited to 'sway')
-rw-r--r-- | sway/desktop/output.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/sway/desktop/output.c b/sway/desktop/output.c index 829029a7..551e96fc 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c | |||
@@ -602,6 +602,7 @@ static void render_container_simple(struct sway_output *output, | |||
602 | static void render_tab(struct sway_output *output, pixman_region32_t *damage, | 602 | static void render_tab(struct sway_output *output, pixman_region32_t *damage, |
603 | struct sway_container *parent, int child_index, | 603 | struct sway_container *parent, int child_index, |
604 | struct border_colors *colors, struct wlr_texture *title_texture) { | 604 | struct border_colors *colors, struct wlr_texture *title_texture) { |
605 | struct sway_container *con = parent->children->items[child_index]; | ||
605 | float output_scale = output->wlr_output->scale; | 606 | float output_scale = output->wlr_output->scale; |
606 | float color[4]; | 607 | float color[4]; |
607 | struct wlr_box box; | 608 | struct wlr_box box; |
@@ -615,6 +616,7 @@ static void render_tab(struct sway_output *output, pixman_region32_t *damage, | |||
615 | 616 | ||
616 | // Single pixel bar above title | 617 | // Single pixel bar above title |
617 | memcpy(&color, colors->border, sizeof(float) * 4); | 618 | memcpy(&color, colors->border, sizeof(float) * 4); |
619 | premultiply_alpha(color, con->alpha); | ||
618 | box.x = x; | 620 | box.x = x; |
619 | box.y = parent->y; | 621 | box.y = parent->y; |
620 | box.width = tab_width; | 622 | box.width = tab_width; |
@@ -665,6 +667,7 @@ static void render_tab(struct sway_output *output, pixman_region32_t *damage, | |||
665 | 667 | ||
666 | // Title background - above the text | 668 | // Title background - above the text |
667 | memcpy(&color, colors->background, sizeof(float) * 4); | 669 | memcpy(&color, colors->background, sizeof(float) * 4); |
670 | premultiply_alpha(color, con->alpha); | ||
668 | box.x = x + 1; | 671 | box.x = x + 1; |
669 | box.y = parent->y + 1; | 672 | box.y = parent->y + 1; |
670 | box.width = tab_width - 2; | 673 | box.width = tab_width - 2; |
@@ -707,7 +710,7 @@ static void render_tab_content(struct sway_output *output, | |||
707 | if (view->border != B_NONE) { | 710 | if (view->border != B_NONE) { |
708 | if (view->border_left) { | 711 | if (view->border_left) { |
709 | memcpy(&color, colors->child_border, sizeof(float) * 4); | 712 | memcpy(&color, colors->child_border, sizeof(float) * 4); |
710 | color[3] *= con->alpha; | 713 | premultiply_alpha(color, con->alpha); |
711 | box.x = con->x; | 714 | box.x = con->x; |
712 | box.y = con->y + config->border_thickness * 2 + config->font_height; | 715 | box.y = con->y + config->border_thickness * 2 + config->font_height; |
713 | box.width = view->border_thickness; | 716 | box.width = view->border_thickness; |
@@ -718,7 +721,7 @@ static void render_tab_content(struct sway_output *output, | |||
718 | 721 | ||
719 | if (view->border_right) { | 722 | if (view->border_right) { |
720 | memcpy(&color, colors->child_border, sizeof(float) * 4); | 723 | memcpy(&color, colors->child_border, sizeof(float) * 4); |
721 | color[3] *= con->alpha; | 724 | premultiply_alpha(color, con->alpha); |
722 | box.x = view->x + view->width; | 725 | box.x = view->x + view->width; |
723 | box.y = con->y + config->border_thickness * 2 + config->font_height; | 726 | box.y = con->y + config->border_thickness * 2 + config->font_height; |
724 | box.width = view->border_thickness; | 727 | box.width = view->border_thickness; |
@@ -729,7 +732,7 @@ static void render_tab_content(struct sway_output *output, | |||
729 | 732 | ||
730 | if (view->border_bottom) { | 733 | if (view->border_bottom) { |
731 | memcpy(&color, colors->child_border, sizeof(float) * 4); | 734 | memcpy(&color, colors->child_border, sizeof(float) * 4); |
732 | color[3] *= con->alpha; | 735 | premultiply_alpha(color, con->alpha); |
733 | box.x = con->x; | 736 | box.x = con->x; |
734 | box.y = view->y + view->height; | 737 | box.y = view->y + view->height; |
735 | box.width = con->width; | 738 | box.width = con->width; |