[gtk+/composite-templates] cssimage: Only create fades if we are actually fading



commit 6c79fcc71fdc02903d05c8bb3b28f745ededa1ca
Author: Benjamin Otte <otte redhat com>
Date:   Tue Oct 2 11:33:11 2012 +0200

    cssimage: Only create fades if we are actually fading

 gtk/gtkcssimage.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkcssimage.c b/gtk/gtkcssimage.c
index 3df7598..999c548 100644
--- a/gtk/gtkcssimage.c
+++ b/gtk/gtkcssimage.c
@@ -75,7 +75,12 @@ gtk_css_image_real_transition (GtkCssImage *start,
                                guint        property_id,
                                double       progress)
 {
-  return _gtk_css_image_cross_fade_new (start, end, progress);
+  if (progress <= 0.0)
+    return g_object_ref (start);
+  else if (progress >= 1.0)
+    return end ? g_object_ref (end) : NULL;
+  else
+    return _gtk_css_image_cross_fade_new (start, end, progress);
 }
 
 static void



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