summaryrefslogtreecommitdiff
path: root/gtk/gtkcssnumbervalue.c
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2016-02-13 04:47:51 +0100
committerBenjamin Otte <otte@redhat.com>2016-02-13 04:49:08 +0100
commit93eec3e52f31f958ca7790e0eaa002e6975c4b57 (patch)
tree3a63cb50fd8d3e8530ccfaf10e6c4f9c083bb437 /gtk/gtkcssnumbervalue.c
parent0cda3ba3e8fb70d3b88b2b810ee7b988ef5f631d (diff)
downloadgtk+-93eec3e52f31f958ca7790e0eaa002e6975c4b57.tar.gz
css: Implement transitions for numbers of different units
We now can transition from 10px to 100%. Note that this requires a teensy tiny hack in gtk_css_value_transition(), but so be it.
Diffstat (limited to 'gtk/gtkcssnumbervalue.c')
-rw-r--r--gtk/gtkcssnumbervalue.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/gtk/gtkcssnumbervalue.c b/gtk/gtkcssnumbervalue.c
index d685fda902..80239d6f4d 100644
--- a/gtk/gtkcssnumbervalue.c
+++ b/gtk/gtkcssnumbervalue.c
@@ -106,6 +106,25 @@ _gtk_css_number_value_new (double value,
return gtk_css_dimension_value_new (value, unit);
}
+GtkCssValue *
+gtk_css_number_value_transition (GtkCssValue *start,
+ GtkCssValue *end,
+ guint property_id,
+ double progress)
+{
+ GtkCssValue *result, *mul_start, *mul_end;
+
+ mul_start = gtk_css_number_value_multiply (start, 1 - progress);
+ mul_end = gtk_css_number_value_multiply (end, progress);
+
+ result = gtk_css_number_value_add (mul_start, mul_end);
+
+ _gtk_css_value_unref (mul_start);
+ _gtk_css_value_unref (mul_end);
+
+ return result;
+}
+
gboolean
gtk_css_number_value_can_parse (GtkCssParser *parser)
{