From 76811b4ebcfa6242cbe6fa5bd7d7d237d415171b Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Fri, 3 Apr 2020 18:04:13 -0300 Subject: [PATCH] st/theme-node: Use the node's scale factor Each node stores the scale factor in place when it was created. Creating nodes with the same style, but with different scale factors, yields different nodes. Use the node's scale factor instead of retrieving the context's one. https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1176 --- src/st/st-theme-node.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/st/st-theme-node.c b/src/st/st-theme-node.c index d1f09db87..157fc2bbf 100644 --- a/src/st/st-theme-node.c +++ b/src/st/st-theme-node.c @@ -979,9 +979,7 @@ get_length_from_term (StThemeNode *node, } type = ABSOLUTE; double multiplier = 1.0; - int scale_factor; - g_object_get (node->context, "scale-factor", &scale_factor, NULL); if (term->type != TERM_NUMBER) { @@ -996,7 +994,7 @@ get_length_from_term (StThemeNode *node, { case NUM_LENGTH_PX: type = ABSOLUTE; - multiplier = 1 * scale_factor; + multiplier = 1 * node->scale_factor; break; case NUM_LENGTH_PT: type = POINTS; @@ -1127,14 +1125,10 @@ get_length_from_term_int (StThemeNode *node, { double value; GetFromTermResult result; - int scale_factor; result = get_length_from_term (node, term, use_parent_font, &value); if (result == VALUE_FOUND) - { - g_object_get (node->context, "scale-factor", &scale_factor, NULL); - *length = (int) ((value / scale_factor) + 0.5) * scale_factor; - } + *length = (int) ((value / node->scale_factor) + 0.5) * node->scale_factor; return result; } @@ -3016,7 +3010,6 @@ StBorderImage * st_theme_node_get_border_image (StThemeNode *node) { int i; - int scale_factor; if (node->border_image_computed) return node->border_image; @@ -3025,7 +3018,6 @@ st_theme_node_get_border_image (StThemeNode *node) node->border_image_computed = TRUE; ensure_properties (node); - g_object_get (node->context, "scale-factor", &scale_factor, NULL); for (i = node->n_properties - 1; i >= 0; i--) { @@ -3130,7 +3122,7 @@ st_theme_node_get_border_image (StThemeNode *node) node->border_image = st_border_image_new (file, border_top, border_right, border_bottom, border_left, - scale_factor); + node->scale_factor); g_object_unref (file);