css: Drop a few dynamic type checks

We hit these code paths a lot
This commit is contained in:
Timm Bäder 2020-05-06 11:40:52 +02:00
parent e12c9de5df
commit 06460ea50c
4 changed files with 6 additions and 11 deletions

View File

@ -53,7 +53,7 @@ gtk_css_animated_style_get_section (GtkCssStyle *style,
static gboolean
gtk_css_animated_style_is_static (GtkCssStyle *style)
{
GtkCssAnimatedStyle *animated = GTK_CSS_ANIMATED_STYLE (style);
GtkCssAnimatedStyle *animated = (GtkCssAnimatedStyle *)style;
guint i;
for (i = 0; i < animated->n_animations; i ++)

View File

@ -293,8 +293,6 @@ gtk_css_style_get_section (GtkCssStyle *style,
gboolean
gtk_css_style_is_static (GtkCssStyle *style)
{
gtk_internal_return_val_if_fail (GTK_IS_CSS_STYLE (style), TRUE);
return GTK_CSS_STYLE_GET_CLASS (style)->is_static (style);
}

View File

@ -30,8 +30,7 @@ static GtkStyleAnimation *
gtk_css_transition_advance (GtkStyleAnimation *style_animation,
gint64 timestamp)
{
GtkCssTransition *source = GTK_CSS_TRANSITION (style_animation);
GtkCssTransition *source = (GtkCssTransition *)style_animation;
GtkCssTransition *transition;
transition = g_object_new (GTK_TYPE_CSS_TRANSITION, NULL);
@ -44,14 +43,14 @@ gtk_css_transition_advance (GtkStyleAnimation *style_animation,
gtk_progress_tracker_advance_frame (&transition->tracker, timestamp);
transition->finished = gtk_progress_tracker_get_state (&transition->tracker) == GTK_PROGRESS_STATE_AFTER;
return GTK_STYLE_ANIMATION (transition);
return (GtkStyleAnimation *)transition;
}
static void
gtk_css_transition_apply_values (GtkStyleAnimation *style_animation,
GtkCssAnimatedStyle *style)
{
GtkCssTransition *transition = GTK_CSS_TRANSITION (style_animation);
GtkCssTransition *transition = (GtkCssTransition *)style_animation;
GtkCssValue *value, *end;
double progress;
GtkProgressState state;
@ -86,7 +85,7 @@ gtk_css_transition_apply_values (GtkStyleAnimation *style_animation,
static gboolean
gtk_css_transition_is_finished (GtkStyleAnimation *animation)
{
GtkCssTransition *transition = GTK_CSS_TRANSITION (animation);
GtkCssTransition *transition = (GtkCssTransition *)animation;
return transition->finished;
}
@ -94,7 +93,7 @@ gtk_css_transition_is_finished (GtkStyleAnimation *animation)
static gboolean
gtk_css_transition_is_static (GtkStyleAnimation *animation)
{
GtkCssTransition *transition = GTK_CSS_TRANSITION (animation);
GtkCssTransition *transition = (GtkCssTransition *)animation;
return transition->finished;
}

View File

@ -117,8 +117,6 @@ _gtk_style_animation_is_static (GtkStyleAnimation *animation)
{
GtkStyleAnimationClass *klass;
g_return_val_if_fail (GTK_IS_STYLE_ANIMATION (animation), TRUE);
klass = GTK_STYLE_ANIMATION_GET_CLASS (animation);
return klass->is_static (animation);