[gtk/wip/baedert/gl-rework: 4/4] renderbackground: Try to omit a save/restore pair
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/baedert/gl-rework: 4/4] renderbackground: Try to omit a save/restore pair
- Date: Wed, 18 Dec 2019 13:59:27 +0000 (UTC)
commit 04d9eeed896068958af1dbbe3d529842d2e56f2d
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]