mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-15 14:50:06 +00:00
css: Avoid more recomputation during animation
Don't trigger recomputation if the values didn't change. We only do this for custom values, since those are animated with a flip at 50%, so it is likely that we see no-change updates.
This commit is contained in:
parent
2aeb80f490
commit
6bae80c331
@ -645,15 +645,20 @@ gtk_css_animated_style_get_intrinsic_value (GtkCssAnimatedStyle *style,
|
||||
return gtk_css_style_get_value (style->style, id);
|
||||
}
|
||||
|
||||
void
|
||||
gboolean
|
||||
gtk_css_animated_style_set_animated_custom_value (GtkCssAnimatedStyle *animated,
|
||||
int id,
|
||||
GtkCssVariableValue *value)
|
||||
{
|
||||
GtkCssStyle *style = (GtkCssStyle *)animated;
|
||||
GtkCssVariableValue *old_value;
|
||||
|
||||
gtk_internal_return_if_fail (GTK_IS_CSS_ANIMATED_STYLE (style));
|
||||
gtk_internal_return_if_fail (value != NULL);
|
||||
gtk_internal_return_val_if_fail (GTK_IS_CSS_ANIMATED_STYLE (style), FALSE);
|
||||
gtk_internal_return_val_if_fail (value != NULL, FALSE);
|
||||
|
||||
old_value = gtk_css_style_get_custom_property (style, id);
|
||||
if (gtk_css_value_equal0 ((GtkCssValue *) old_value, (GtkCssValue *) value))
|
||||
return FALSE;
|
||||
|
||||
if (style->variables == NULL)
|
||||
{
|
||||
@ -669,6 +674,8 @@ gtk_css_animated_style_set_animated_custom_value (GtkCssAnimatedStyle *animated,
|
||||
}
|
||||
|
||||
gtk_css_variable_set_add (style->variables, id, value);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -70,7 +70,7 @@ void gtk_css_animated_style_set_animated_value(GtkCssAnimated
|
||||
GtkCssValue * gtk_css_animated_style_get_intrinsic_value (GtkCssAnimatedStyle *style,
|
||||
guint id);
|
||||
|
||||
void gtk_css_animated_style_set_animated_custom_value (GtkCssAnimatedStyle *animated,
|
||||
gboolean gtk_css_animated_style_set_animated_custom_value (GtkCssAnimatedStyle *animated,
|
||||
int id,
|
||||
GtkCssVariableValue *value);
|
||||
|
||||
|
@ -126,11 +126,10 @@ gtk_css_animation_apply_values (GtkStyleAnimation *style_animation,
|
||||
if (!value)
|
||||
continue;
|
||||
|
||||
gtk_css_animated_style_set_animated_custom_value (style, variable_id, value);
|
||||
if (gtk_css_animated_style_set_animated_custom_value (style, variable_id, value))
|
||||
change |= GTK_CSS_ANIMATION_CHANGE_VARIABLES;
|
||||
|
||||
gtk_css_variable_value_unref (value);
|
||||
|
||||
change |= GTK_CSS_ANIMATION_CHANGE_VARIABLES;
|
||||
}
|
||||
|
||||
for (i = 0; i < _gtk_css_keyframes_get_n_properties (resolved_keyframes); i++)
|
||||
|
Loading…
Reference in New Issue
Block a user