[gnome-shell/wip/gdm-shell: 7/16] StAdjustment: Add alpha arg to interpolate method



commit ff9b2555a6f73a53aad91f2997dac2dce2872a79
Author: Ray Strode <rstrode redhat com>
Date:   Sat Jul 9 00:44:13 2011 -0400

    StAdjustment: Add alpha arg to interpolate method
    
    This commit adds an optional "alpha" argument to
    st_adjustment_interpolate that gives the caller
    control over how the interpolation should happen.

 src/st/st-adjustment.c |   22 ++++++++++++++++------
 src/st/st-adjustment.h |    1 +
 2 files changed, 17 insertions(+), 6 deletions(-)
---
diff --git a/src/st/st-adjustment.c b/src/st/st-adjustment.c
index 69312c5..43fb615 100644
--- a/src/st/st-adjustment.c
+++ b/src/st/st-adjustment.c
@@ -704,6 +704,7 @@ interpolation_completed_cb (ClutterTimeline *timeline,
 
 void
 st_adjustment_interpolate (StAdjustment *adjustment,
+                           ClutterAlpha *alpha,
                            gdouble       value,
                            guint         duration)
 {
@@ -722,12 +723,21 @@ st_adjustment_interpolate (StAdjustment *adjustment,
 
   priv->interpolation = clutter_timeline_new (duration);
 
-  if (priv->elastic)
-    priv->bounce_alpha = clutter_alpha_new_full (priv->interpolation,
-                                                 CLUTTER_EASE_OUT_ELASTIC);
+  if (alpha != NULL)
+    {
+      clutter_alpha_set_timeline (alpha, priv->interpolation);
+      priv->bounce_alpha = g_object_ref (alpha);
+    }
+  else if (priv->elastic)
+    {
+      priv->bounce_alpha = clutter_alpha_new_full (priv->interpolation,
+                                                   CLUTTER_EASE_OUT_ELASTIC);
+    }
   else
-    priv->bounce_alpha = clutter_alpha_new_full (priv->interpolation,
-                                                 CLUTTER_LINEAR);
+    {
+      priv->bounce_alpha = clutter_alpha_new_full (priv->interpolation,
+                                                   CLUTTER_LINEAR);
+    }
 
   g_signal_connect (priv->interpolation,
                     "new-frame",
@@ -771,7 +781,7 @@ st_adjustment_clamp (StAdjustment *adjustment,
   if (dest != priv->value)
     {
       if (interpolate)
-        st_adjustment_interpolate (adjustment, dest, duration);
+        st_adjustment_interpolate (adjustment, NULL, dest, duration);
       else
         st_adjustment_set_value (adjustment, dest);
 
diff --git a/src/st/st-adjustment.h b/src/st/st-adjustment.h
index 3cfce64..df691af 100644
--- a/src/st/st-adjustment.h
+++ b/src/st/st-adjustment.h
@@ -101,6 +101,7 @@ void          st_adjustment_get_values  (StAdjustment *adjustment,
                                          gdouble      *page_size);
 
 void          st_adjustment_interpolate (StAdjustment *adjustment,
+                                         ClutterAlpha *alpha,
                                          gdouble       value,
                                          guint         duration);
 



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