[gtk/matthiasc/css-values: 9/12] css: Do more computation ahead of time
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/matthiasc/css-values: 9/12] css: Do more computation ahead of time
- Date: Fri, 10 Jan 2020 18:03:48 +0000 (UTC)
commit 34b954a4a84dcfe19b796a1e290b7a1b62314e87
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Jan 10 12:00:24 2020 -0500
css: Do more computation ahead of time
The computation we do for angles and times does not
depend on the context, and can be done at creation
time.
gtk/gtkcssdimensionvalue.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
---
diff --git a/gtk/gtkcssdimensionvalue.c b/gtk/gtkcssdimensionvalue.c
index 0ed99339e2..e4463bec8d 100644
--- a/gtk/gtkcssdimensionvalue.c
+++ b/gtk/gtkcssdimensionvalue.c
@@ -408,6 +408,26 @@ gtk_css_dimension_value_new (double value,
break;
+ case GTK_CSS_RAD:
+ value = value * 360.0 / (2 * G_PI);
+ unit = GTK_CSS_DEG;
+ break;
+
+ case GTK_CSS_GRAD:
+ value = value * 360.0 / 400.0;
+ unit = GTK_CSS_DEG;
+ break;
+
+ case GTK_CSS_TURN:
+ value = value * 360.0;
+ unit = GTK_CSS_DEG;
+ break;
+
+ case GTK_CSS_MS:
+ value = value / 1000.0;
+ unit = GTK_CSS_S;
+ break;
+
default:
;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]