[gtk/matthiasc/css-values: 1/4] css: Do more computation ahead of time



commit 3ab92d2039a2bd11b9b60a16d260883da0ab4e14
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]