From: Timm Bäder Date: Wed, 18 Dec 2019 10:43:26 +0000 (+0100) Subject: renderbackground: Try to omit a save/restore pair X-Git-Tag: archive/raspbian/4.4.1+ds1-2+rpi1^2~18^2~20^2~409 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=d490d8f1f32f4b89ce59973034f0557c6074feb4;p=gtk4.git renderbackground: Try to omit a save/restore pair --- diff --git a/gtk/gtkrenderbackground.c b/gtk/gtkrenderbackground.c index ed85535529..b241a7e615 100644 --- a/gtk/gtkrenderbackground.c +++ b/gtk/gtkrenderbackground.c @@ -150,12 +150,17 @@ gtk_theming_background_snapshot_layer (GtkCssBoxes *bg, if (hrepeat == GTK_CSS_REPEAT_STYLE_NO_REPEAT && vrepeat == GTK_CSS_REPEAT_STYLE_NO_REPEAT) { /* shortcut for normal case */ - gtk_snapshot_save (snapshot); - gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (x, y)); - - gtk_css_image_snapshot (image, snapshot, image_width, image_height); - - gtk_snapshot_restore (snapshot); + if (x != 0 || y != 0) + { + gtk_snapshot_save (snapshot); + gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (x, y)); + gtk_css_image_snapshot (image, snapshot, image_width, image_height); + gtk_snapshot_restore (snapshot); + } + else + { + gtk_css_image_snapshot (image, snapshot, image_width, image_height); + } } else {