[gtk/matthiasc/css-values: 8/11] css: Do more computation ahead of time



commit 9ab78cd215eaa7f3980ea1551747b06c0e099bb5
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]