OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef UI_AURA_GESTURES_VELOCITY_CALCULATOR_H_ | |
6 #define UI_AURA_GESTURES_VELOCITY_CALCULATOR_H_ | |
7 #pragma once | |
8 | |
9 #include <vector> | |
10 #include "ui/aura/aura_export.h" | |
11 | |
12 namespace aura { | |
13 | |
14 class AURA_EXPORT VelocityCalculator { | |
15 public: | |
16 explicit VelocityCalculator(int bufferSize); | |
17 ~VelocityCalculator(); | |
18 void PointSeen(float x, float y, double time); | |
19 void Velocity(float* x, float*y); | |
Ian Vollick
2012/02/02 16:40:23
Since we want to get the velocity after every poin
| |
20 void ClearHistory(); | |
Ian Vollick
2012/02/02 16:40:23
newline between lines 20 and 21
| |
21 private: | |
22 struct Point { | |
23 float x; | |
24 float y; | |
25 double time; | |
26 }; | |
27 | |
28 typedef std::vector<Point> HistoryBuffer; | |
rjkroege
2012/02/02 15:58:37
since the array is fixed size, why not an array?
| |
29 HistoryBuffer buffer_; | |
30 | |
31 // index_ points directly after the last point added | |
32 int index_; | |
33 size_t num_valid_entries_; | |
34 const size_t buffer_size_; | |
35 }; | |
36 } // namespace aura | |
37 | |
38 #endif // UI_AURA_GESTURES_VELOCITY_CALCULATOR_H_ | |
OLD | NEW |