[gtk] renderbackground: Try to omit a save/restore pair
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk] renderbackground: Try to omit a save/restore pair
- Date: Tue, 7 Jan 2020 16:39:18 +0000 (UTC)
commit d490d8f1f32f4b89ce59973034f0557c6074feb4
Author: Timm Bäder <mail baedert org>
Date: Wed Dec 18 11:43:26 2019 +0100
renderbackground: Try to omit a save/restore pair
gtk/gtkrenderbackground.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
---
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
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]