Bug 1498329 - Fix a bug in AndroidVelocityTracker::ComputeVelocity() where we were unintentionally ignoring the oldest data point. r=kats
authorBotond Ballo <botond@mozilla.com>
Mon, 15 Oct 2018 23:29:21 +0000
changeset 489709 b8d65158722104c789df029684d2081288ff6081
parent 489708 783ec708b98b02c22368ef1f1da587dbf6fe4294
child 489710 8ceb713af9c7f2b453f42c46bd9ffd8ae1aece44
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewerskats
bugs1498329
milestone64.0a1
Bug 1498329 - Fix a bug in AndroidVelocityTracker::ComputeVelocity() where we were unintentionally ignoring the oldest data point. r=kats Differential Revision: https://phabricator.services.mozilla.com/D8786
gfx/layers/apz/src/AndroidVelocityTracker.cpp
--- a/gfx/layers/apz/src/AndroidVelocityTracker.cpp
+++ b/gfx/layers/apz/src/AndroidVelocityTracker.cpp
@@ -274,17 +274,17 @@ AndroidVelocityTracker::ComputeVelocity(
       break;
 
     ParentLayerCoord position = movement.second;
     pos[m] = position;
     w[m] = 1.0f;
     time[m] = -static_cast<float>(age) / 1000.0f;  // in seconds
     index--;
     m++;
-  } while (index > 0);
+  } while (index >= 0);
 
   if (m == 0) {
     return velocity;  // no data
   }
 
   // Calculate a least squares polynomial fit.
 
   // Polynomial degree (number of coefficients), or zero if no information is