diff options
author | Timm Bäder <mail@baedert.org> | 2020-01-11 13:40:13 +0100 |
---|---|---|
committer | Timm Bäder <mail@baedert.org> | 2020-01-18 08:49:51 +0100 |
commit | 24d8c0a7dccc12edc97753049c1b7765dd4d5a27 (patch) | |
tree | ae438868d480f52b0d8b9eadf7ce185446b3362c /gtk/gtkcssfiltervalue.c | |
parent | ba08f5e67da5dcb0bb68e23f50c37091846ce682 (diff) | |
download | gtk+-24d8c0a7dccc12edc97753049c1b7765dd4d5a27.tar.gz |
css: Set the is_computed flag for more values
With these changes, we skip roughly 85% of compute() calls during
widget-factory startup
Diffstat (limited to 'gtk/gtkcssfiltervalue.c')
-rw-r--r-- | gtk/gtkcssfiltervalue.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/gtk/gtkcssfiltervalue.c b/gtk/gtkcssfiltervalue.c index 8129cf971c..453803000e 100644 --- a/gtk/gtkcssfiltervalue.c +++ b/gtk/gtkcssfiltervalue.c @@ -778,6 +778,7 @@ gtk_css_filter_value_parse (GtkCssParser *parser) GtkCssValue *value; GArray *array; guint i; + gboolean computed = TRUE; if (gtk_css_parser_try_ident (parser, "none")) return gtk_css_filter_value_new_none (); @@ -794,6 +795,7 @@ gtk_css_filter_value_parse (GtkCssParser *parser) goto fail; filter.type = GTK_CSS_FILTER_BLUR; + computed = computed && gtk_css_value_is_computed (filter.blur.value); } else if (gtk_css_parser_has_function (parser, "brightness")) { @@ -801,6 +803,7 @@ gtk_css_filter_value_parse (GtkCssParser *parser) goto fail; filter.type = GTK_CSS_FILTER_BRIGHTNESS; + computed = computed && gtk_css_value_is_computed (filter.brightness.value); } else if (gtk_css_parser_has_function (parser, "contrast")) { @@ -808,6 +811,7 @@ gtk_css_filter_value_parse (GtkCssParser *parser) goto fail; filter.type = GTK_CSS_FILTER_CONTRAST; + computed = computed && gtk_css_value_is_computed (filter.contrast.value); } else if (gtk_css_parser_has_function (parser, "grayscale")) { @@ -815,13 +819,15 @@ gtk_css_filter_value_parse (GtkCssParser *parser) goto fail; filter.type = GTK_CSS_FILTER_GRAYSCALE; + computed = computed && gtk_css_value_is_computed (filter.grayscale.value); } else if (gtk_css_parser_has_function (parser, "hue-rotate")) { - if (!gtk_css_parser_consume_function (parser, 1, 1, gtk_css_filter_parse_angle, &filter.blur.value)) + if (!gtk_css_parser_consume_function (parser, 1, 1, gtk_css_filter_parse_angle, &filter.hue_rotate.value)) goto fail; filter.type = GTK_CSS_FILTER_HUE_ROTATE; + computed = computed && gtk_css_value_is_computed (filter.hue_rotate.value); } else if (gtk_css_parser_has_function (parser, "invert")) { @@ -829,6 +835,7 @@ gtk_css_filter_value_parse (GtkCssParser *parser) goto fail; filter.type = GTK_CSS_FILTER_INVERT; + computed = computed && gtk_css_value_is_computed (filter.invert.value); } else if (gtk_css_parser_has_function (parser, "opacity")) { @@ -836,6 +843,7 @@ gtk_css_filter_value_parse (GtkCssParser *parser) goto fail; filter.type = GTK_CSS_FILTER_OPACITY; + computed = computed && gtk_css_value_is_computed (filter.opacity.value); } else if (gtk_css_parser_has_function (parser, "saturate")) { @@ -843,6 +851,7 @@ gtk_css_filter_value_parse (GtkCssParser *parser) goto fail; filter.type = GTK_CSS_FILTER_SATURATE; + computed = computed && gtk_css_value_is_computed (filter.saturate.value); } else if (gtk_css_parser_has_function (parser, "sepia")) { @@ -850,6 +859,7 @@ gtk_css_filter_value_parse (GtkCssParser *parser) goto fail; filter.type = GTK_CSS_FILTER_SEPIA; + computed = computed && gtk_css_value_is_computed (filter.sepia.value); } else { @@ -867,6 +877,7 @@ gtk_css_filter_value_parse (GtkCssParser *parser) value = gtk_css_filter_value_alloc (array->len); memcpy (value->filters, array->data, sizeof (GtkCssFilter) * array->len); + value->is_computed = computed; g_array_free (array, TRUE); |