summaryrefslogtreecommitdiff
path: root/gtk/gtkcssdimensionvalue.c
diff options
context:
space:
mode:
authorTimm Bäder <mail@baedert.org>2020-01-25 19:40:13 +0100
committerTimm Bäder <mail@baedert.org>2020-01-26 18:21:07 +0100
commit352c9ba42a3bd60c3500ae903b59813edf034ef5 (patch)
tree3b36b735c067b4361483aaab8708e599c8c6360a /gtk/gtkcssdimensionvalue.c
parent30b37dd7c5e5fa34953f281e459145ea73c7e522 (diff)
downloadgtk+-352c9ba42a3bd60c3500ae903b59813edf034ef5.tar.gz
dimensionvalue: Add gtk_css_{dimension,corner}_value_is_zero()
We can usually omit computations when the dimension value ends up being zero anyway.
Diffstat (limited to 'gtk/gtkcssdimensionvalue.c')
-rw-r--r--gtk/gtkcssdimensionvalue.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/gtk/gtkcssdimensionvalue.c b/gtk/gtkcssdimensionvalue.c
index 0e7020708a..d8e06af052 100644
--- a/gtk/gtkcssdimensionvalue.c
+++ b/gtk/gtkcssdimensionvalue.c
@@ -497,3 +497,14 @@ gtk_css_dimension_value_parse (GtkCssParser *parser,
return result;
}
+gboolean
+gtk_css_dimension_value_is_zero (const GtkCssValue *value)
+{
+ if (!value)
+ return TRUE;
+
+ if (value->class != &GTK_CSS_VALUE_DIMENSION.value_class)
+ return FALSE;
+
+ return value->value == 0;
+}