Avoid a few state changes

We can't optimize the save/restore calls away in the snapshot code, so
do it from the caller side.
This commit is contained in:
Timm Bäder 2019-12-17 17:15:17 +01:00
parent b8aa51d522
commit 6a9bc5daef
2 changed files with 22 additions and 8 deletions

View File

@ -1136,11 +1136,18 @@ gtk_image_snapshot (GtkWidget *widget,
else
y = CLAMP (baseline - h * gtk_image_get_baseline_align (image), 0, height - ceil (h));
if (x != 0 || y != 0)
{
gtk_snapshot_save (snapshot);
gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (x, y));
gdk_paintable_snapshot (GDK_PAINTABLE (priv->icon_helper), snapshot, w, h);
gtk_snapshot_restore (snapshot);
}
else
{
gdk_paintable_snapshot (GDK_PAINTABLE (priv->icon_helper), snapshot, w, h);
}
}
}
static void

View File

@ -13085,6 +13085,8 @@ gtk_widget_snapshot_child (GtkWidget *widget,
if (GTK_IS_NATIVE (child))
return;
if (priv->transform)
{
gtk_snapshot_save (snapshot);
gtk_snapshot_transform (snapshot, priv->transform);
@ -13092,6 +13094,11 @@ gtk_widget_snapshot_child (GtkWidget *widget,
gtk_snapshot_restore (snapshot);
}
else
{
gtk_widget_snapshot (child, snapshot);
}
}
/**
* gtk_widget_set_focus_child: