summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimm Bäder <mail@baedert.org>2020-06-21 08:31:24 +0200
committerTimm Bäder <mail@baedert.org>2020-06-27 10:51:06 +0200
commit8fcf1b78a44963d2251857a255e9c2d04d426e7a (patch)
tree7b0ff85ca1cb0b5685c82c7c0ee60425ef0f893f
parent21f914815526bebab7d71bb72f2484995d80ecb7 (diff)
downloadgtk+-8fcf1b78a44963d2251857a255e9c2d04d426e7a.tar.gz
renderbackground: Only query h/vrepeat if we need to
-rw-r--r--gtk/gtkrenderbackground.c8
1 files 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);