Commit 57cd3391 authored by Timm Bäder's avatar Timm Bäder 👎

widget: Only push a transform if we need to

parent 63ef6a06
......@@ -2910,6 +2910,7 @@ gtk_widget_init (GTypeInstance *instance, gpointer g_class)
}
graphene_matrix_init_identity (&priv->transform);
priv->has_transform = FALSE;
/* this will be set to TRUE if the widget gets a child or if the
* expand flag is set on the widget, but until one of those happen
......@@ -4335,6 +4336,7 @@ gtk_widget_size_allocate_transformed (GtkWidget *widget,
priv->allocation = real_allocation;
priv->allocated_baseline = baseline;
priv->transform = final_transform;
priv->has_transform = !graphene_matrix_is_identity (&final_transform);
if (!alloc_needed && !size_changed && !baseline_changed)
{
......@@ -13589,9 +13591,13 @@ gtk_widget_snapshot_child (GtkWidget *widget,
g_return_if_fail (_gtk_widget_get_parent (child) == widget);
g_return_if_fail (snapshot != NULL);
gtk_snapshot_push_transform (snapshot, &priv->transform);
if (priv->has_transform)
gtk_snapshot_push_transform (snapshot, &priv->transform);
gtk_widget_snapshot (child, snapshot);
gtk_snapshot_pop (snapshot);
if (priv->has_transform)
gtk_snapshot_pop (snapshot);
}
/**
......@@ -13831,6 +13837,8 @@ gtk_widget_set_transform (GtkWidget *widget,
{
GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
priv->has_transform = !graphene_matrix_is_identity (transform);
graphene_matrix_init_from_matrix (&priv->transform, transform);
}
......
......@@ -146,6 +146,7 @@ struct _GtkWidgetPrivate
graphene_matrix_t allocated_transform;
graphene_matrix_t transform;
guint has_transform : 1;
/* The widget's requested sizes */
SizeRequestCache requests;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment