diff --git a/gtk/gtkimage.c b/gtk/gtkimage.c index 751ae9de23..8a415750e9 100644 --- a/gtk/gtkimage.c +++ b/gtk/gtkimage.c @@ -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); + } } } diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index 8119b06fd4..2a67391479 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -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); + } } /**