Bug 827715; correct fling friction implmentation. r=cjones; a=blocking-basecamp
authorNicholas Cameron <ncameron@mozilla.com>
Mon, 14 Jan 2013 13:02:41 -0800
changeset 118807 37eb156ec02cdfb65696b32f63b6fc121fd95890
parent 118806 73d7a2071c7c2acbb21d16c1b56623377deff677
child 118808 d61ca06c98d9b4dd4aee0b31a5b55d0e44673209
push id24180
push useremorley@mozilla.com
push dateTue, 15 Jan 2013 22:58:27 +0000
treeherdermozilla-central@72e34ce7fd92 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscjones, blocking-basecamp
bugs827715
milestone21.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 827715; correct fling friction implmentation. r=cjones; a=blocking-basecamp
gfx/layers/ipc/Axis.cpp
--- a/gfx/layers/ipc/Axis.cpp
+++ b/gfx/layers/ipc/Axis.cpp
@@ -19,17 +19,17 @@ static const float EPSILON = 0.0001f;
  * or we get a touch point very far away from the previous position for some
  * reason.
  */
 static float gMaxEventAcceleration = 999.0f;
 
 /**
  * Amount of friction applied during flings.
  */
-static float gFlingFriction = 0.007f;
+static float gFlingFriction = 0.006f;
 
 /**
  * Threshold for velocity beneath which we turn off any acceleration we had
  * during repeated flings.
  */
 static float gVelocityThreshold = 0.14f;
 
 /**
@@ -157,17 +157,17 @@ void Axis::CancelTouch() {
 bool Axis::FlingApplyFrictionOrCancel(const TimeDuration& aDelta) {
   if (fabsf(mVelocity) <= gFlingStoppedThreshold) {
     // If the velocity is very low, just set it to 0 and stop the fling,
     // otherwise we'll just asymptotically approach 0 and the user won't
     // actually see any changes.
     mVelocity = 0.0f;
     return false;
   } else {
-    mVelocity *= NS_MAX(1.0f - gFlingFriction * aDelta.ToMilliseconds(), 0.0);
+    mVelocity *= pow(1.0f - gFlingFriction, float(aDelta.ToMilliseconds()));
   }
   return true;
 }
 
 Axis::Overscroll Axis::GetOverscroll() {
   // If the current pan takes the window to the left of or above the current
   // page rect.
   bool minus = GetOrigin() < GetPageStart();