[gtk/wip/baedert/for-master: 97/101] renderbackground: Only query h/vrepeat if we need to



commit 7ea2a24a42682ad3e9d1a0321ecb68d3c0f6f799
Author: Timm Bäder <mail baedert org>
Date:   Sun Jun 21 08:31:24 2020 +0200

    renderbackground: Only query h/vrepeat if we need to

 gtk/gtkrenderbackground.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkrenderbackground.c b/gtk/gtkrenderbackground.c
index fb17730900..11c9c109c6 100644
--- a/gtk/gtkrenderbackground.c
+++ b/gtk/gtkrenderbackground.c
@@ -94,9 +94,6 @@ gtk_theming_background_snapshot_layer (GtkCssBoxes *bg,
 
   pos = _gtk_css_array_value_get_nth (background->background_position, idx);
   repeat = _gtk_css_array_value_get_nth (background->background_repeat, idx);
-  hrepeat = _gtk_css_background_repeat_value_get_x (repeat);
-  vrepeat = _gtk_css_background_repeat_value_get_y (repeat);
-
 
   origin = gtk_css_boxes_get_box (bg,
                                   _gtk_css_area_value_get (
@@ -125,8 +122,13 @@ gtk_theming_background_snapshot_layer (GtkCssBoxes *bg,
   /* optimization */
   if (image_width == width)
     hrepeat = GTK_CSS_REPEAT_STYLE_NO_REPEAT;
+  else
+    hrepeat = _gtk_css_background_repeat_value_get_x (repeat);
+
   if (image_height == height)
     vrepeat = GTK_CSS_REPEAT_STYLE_NO_REPEAT;
+  else
+    vrepeat = _gtk_css_background_repeat_value_get_y (repeat);
 
   gtk_snapshot_push_debug (snapshot, "Layer %u", idx);
   gtk_snapshot_push_rounded_clip (snapshot, clip);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]