forked from AuroraMiddleware/gtk
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:
parent
b8aa51d522
commit
6a9bc5daef
@ -1136,10 +1136,17 @@ gtk_image_snapshot (GtkWidget *widget,
|
||||
else
|
||||
y = CLAMP (baseline - h * gtk_image_get_baseline_align (image), 0, height - ceil (h));
|
||||
|
||||
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);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -13085,12 +13085,19 @@ gtk_widget_snapshot_child (GtkWidget *widget,
|
||||
if (GTK_IS_NATIVE (child))
|
||||
return;
|
||||
|
||||
gtk_snapshot_save (snapshot);
|
||||
gtk_snapshot_transform (snapshot, priv->transform);
|
||||
if (priv->transform)
|
||||
{
|
||||
gtk_snapshot_save (snapshot);
|
||||
gtk_snapshot_transform (snapshot, priv->transform);
|
||||
|
||||
gtk_widget_snapshot (child, snapshot);
|
||||
gtk_widget_snapshot (child, snapshot);
|
||||
|
||||
gtk_snapshot_restore (snapshot);
|
||||
gtk_snapshot_restore (snapshot);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_widget_snapshot (child, snapshot);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user