Index: ui/aura/gestures/velocity_calculator.h |
diff --git a/ui/aura/gestures/velocity_calculator.h b/ui/aura/gestures/velocity_calculator.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..c867d2d56e3d35f68330f2a564e4357ef396bbd4 |
--- /dev/null |
+++ b/ui/aura/gestures/velocity_calculator.h |
@@ -0,0 +1,38 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef UI_AURA_GESTURES_VELOCITY_CALCULATOR_H_ |
+#define UI_AURA_GESTURES_VELOCITY_CALCULATOR_H_ |
+#pragma once |
+ |
+#include <vector> |
+#include "ui/aura/aura_export.h" |
+ |
+namespace aura { |
+ |
+class AURA_EXPORT VelocityCalculator { |
+ public: |
+ explicit VelocityCalculator(int bufferSize); |
+ ~VelocityCalculator(); |
+ void PointSeen(float x, float y, double time); |
+ void Velocity(float* x, float*y); |
Ian Vollick
2012/02/02 16:40:23
Since we want to get the velocity after every poin
|
+ void ClearHistory(); |
Ian Vollick
2012/02/02 16:40:23
newline between lines 20 and 21
|
+ private: |
+ struct Point { |
+ float x; |
+ float y; |
+ double time; |
+ }; |
+ |
+ typedef std::vector<Point> HistoryBuffer; |
rjkroege
2012/02/02 15:58:37
since the array is fixed size, why not an array?
|
+ HistoryBuffer buffer_; |
+ |
+ // index_ points directly after the last point added |
+ int index_; |
+ size_t num_valid_entries_; |
+ const size_t buffer_size_; |
+}; |
+} // namespace aura |
+ |
+#endif // UI_AURA_GESTURES_VELOCITY_CALCULATOR_H_ |