summaryrefslogtreecommitdiff
path: root/gtk/gtkcssanimatedstyle.c
diff options
context:
space:
mode:
authorTimm Bäder <mail@baedert.org>2019-08-19 08:45:07 +0200
committerTimm Bäder <mail@baedert.org>2019-09-09 17:36:23 +0200
commiteeb5cd2321c7b5c8c4c7570ec08e78b9e68e75f4 (patch)
tree8086536c4b80fcf75c3a61e3efe9f824e8621336 /gtk/gtkcssanimatedstyle.c
parent5c705ae9a5ed1319c1950fdd9c23138c733c481a (diff)
downloadgtk+-eeb5cd2321c7b5c8c4c7570ec08e78b9e68e75f4.tar.gz
cssanimatedstyle: Avoid unnecessary transition work
No need to do all the transition work if the transition duration will be 0 for all of them.
Diffstat (limited to 'gtk/gtkcssanimatedstyle.c')
-rw-r--r--gtk/gtkcssanimatedstyle.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/gtk/gtkcssanimatedstyle.c b/gtk/gtkcssanimatedstyle.c
index 2b75451840..21cc98c4fc 100644
--- a/gtk/gtkcssanimatedstyle.c
+++ b/gtk/gtkcssanimatedstyle.c
@@ -272,12 +272,18 @@ gtk_css_animated_style_create_css_transitions (GSList *animations,
GtkCssValue *durations, *delays, *timing_functions;
guint i;
- transition_infos_set (transitions, gtk_css_style_get_value (base_style, GTK_CSS_PROPERTY_TRANSITION_PROPERTY));
-
durations = gtk_css_style_get_value (base_style, GTK_CSS_PROPERTY_TRANSITION_DURATION);
delays = gtk_css_style_get_value (base_style, GTK_CSS_PROPERTY_TRANSITION_DELAY);
timing_functions = gtk_css_style_get_value (base_style, GTK_CSS_PROPERTY_TRANSITION_TIMING_FUNCTION);
+ if (_gtk_css_array_value_get_n_values (durations) == 1 &&
+ _gtk_css_array_value_get_n_values (delays) == 1 &&
+ _gtk_css_number_value_get (_gtk_css_array_value_get_nth (durations, 0), 100) +
+ _gtk_css_number_value_get (_gtk_css_array_value_get_nth (delays, 0), 100) == 0)
+ return animations;
+
+ transition_infos_set (transitions, gtk_css_style_get_value (base_style, GTK_CSS_PROPERTY_TRANSITION_PROPERTY));
+
for (i = 0; i < GTK_CSS_PROPERTY_N_PROPERTIES; i++)
{
GtkStyleAnimation *animation;