From abf6ebd7fed6d13891eaa5231e29251f17fb9db5 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 14 Jun 2024 14:04:23 -0400 Subject: [PATCH] label: Only put alpha in attributes when needed It does not do much harm, but it broke some of our tests. --- gtk/gtklabel.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c index 414a8d444c..aedd64c47a 100644 --- a/gtk/gtklabel.c +++ b/gtk/gtklabel.c @@ -849,11 +849,14 @@ gtk_label_update_layout_attributes (GtkLabel *self, attr->end_index = link->end; pango_attr_list_insert (attrs, attr); - attr = pango_attr_foreground_alpha_new (CLAMP (link_color->alpha * 65535. + 0.5, 0, 65535)); + if (link_color->alpha < 0.999) + { + attr = pango_attr_foreground_alpha_new (CLAMP (link_color->alpha * 65535. + 0.5, 0, 65535)); - attr->start_index = link->start; - attr->end_index = link->end; - pango_attr_list_insert (attrs, attr); + attr->start_index = link->start; + attr->end_index = link->end; + pango_attr_list_insert (attrs, attr); + } pango_attr_list_unref (link_attrs); }