[gtk/wip/baedert/css-values: 4/20] cssnumbervalue: Move early-out code to GtkCssValue



commit e1cb745807c915f5fdba92055ed3f0e830403a7b
Author: Timm Bäder <mail baedert org>
Date:   Tue Jan 14 15:37:30 2020 +0100

    cssnumbervalue: Move early-out code to GtkCssValue
    
    These checks make sense for all css values.

 gtk/gtkcssnumbervalue.c | 6 ------
 gtk/gtkcssvalue.c       | 3 +++
 2 files changed, 3 insertions(+), 6 deletions(-)
---
diff --git a/gtk/gtkcssnumbervalue.c b/gtk/gtkcssnumbervalue.c
index 83fa257f01..508ba35c99 100644
--- a/gtk/gtkcssnumbervalue.c
+++ b/gtk/gtkcssnumbervalue.c
@@ -115,12 +115,6 @@ gtk_css_number_value_transition (GtkCssValue *start,
 {
   GtkCssValue *result, *mul_start, *mul_end;
 
-  if (progress == 0)
-    return _gtk_css_value_ref (start);
-
-  if (progress == 1)
-    return _gtk_css_value_ref (end);
-
   if (start == end)
     return _gtk_css_value_ref (start);
 
diff --git a/gtk/gtkcssvalue.c b/gtk/gtkcssvalue.c
index d803574fa9..bc525d468e 100644
--- a/gtk/gtkcssvalue.c
+++ b/gtk/gtkcssvalue.c
@@ -266,6 +266,9 @@ _gtk_css_value_transition (GtkCssValue *start,
   if (progress == 1)
     return _gtk_css_value_ref (end);
 
+  if (start == end)
+    return _gtk_css_value_ref (start);
+
 #ifdef CSS_VALUE_ACCOUNTING
   get_accounting_data (start->class->type_name)->transitioned++;
 #endif


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]