[gtk/initial-style: 2/3] background: Don't render initial backgrounds
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/initial-style: 2/3] background: Don't render initial backgrounds
- Date: Sat, 1 Feb 2020 08:14:00 +0000 (UTC)
commit 7fbb37a09ff2e8eab5ceb51718fb6bbe458810ea
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Feb 1 09:11:39 2020 +0100
background: Don't render initial backgrounds
Add a fast exit for the common case that the background
values are unset.
gtk/gtkrenderbackground.c | 23 +++++++++++++++++------
1 file changed, 17 insertions(+), 6 deletions(-)
---
diff --git a/gtk/gtkrenderbackground.c b/gtk/gtkrenderbackground.c
index cb387f1c9d..2868e39ed2 100644
--- a/gtk/gtkrenderbackground.c
+++ b/gtk/gtkrenderbackground.c
@@ -261,14 +261,25 @@ gtk_css_style_snapshot_background (GtkCssBoxes *boxes,
GtkSnapshot *snapshot)
{
GtkCssBackgroundValues *background = boxes->style->background;
- GtkCssValue *background_image = background->background_image;
- const GdkRGBA *bg_color = gtk_css_color_value_get_rgba (background->background_color);
- const GtkCssValue *box_shadow = background->box_shadow;
- const gboolean has_bg_color = !gdk_rgba_is_clear (bg_color);
- const gboolean has_bg_image = _gtk_css_image_value_get_image (_gtk_css_array_value_get_nth
(background_image, 0)) != NULL;
- const gboolean has_shadow = !gtk_css_shadow_value_is_none (box_shadow);
+ GtkCssValue *background_image;
+ const GdkRGBA *bg_color;
+ const GtkCssValue *box_shadow;
+ gboolean has_bg_color;
+ gboolean has_bg_image;
+ gboolean has_shadow;
gint idx;
+ if (background->base.type == GTK_CSS_BACKGROUND_INITIAL_VALUES)
+ return;
+
+ background_image = background->background_image;
+ bg_color = gtk_css_color_value_get_rgba (background->background_color);
+ box_shadow = background->box_shadow;
+
+ has_bg_color = !gdk_rgba_is_clear (bg_color);
+ has_bg_image = _gtk_css_image_value_get_image (_gtk_css_array_value_get_nth (background_image, 0)) != NULL;
+ has_shadow = !gtk_css_shadow_value_is_none (box_shadow);
+
/* This is the common default case of no background */
if (!has_bg_color && !has_bg_image && !has_shadow)
return;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]