Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(439)

Side by Side Diff: ui/aura/gestures/velocity_calculator.h

Issue 9310031: Event smoothing in CrOS gesture recognizer. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Cache velocity data in VelocityCalculator. Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 #include "base/basictypes.h"
12
13 namespace aura {
14
15 class AURA_EXPORT VelocityCalculator {
sadrul 2012/02/02 22:04:06 Avoid AURA_EXPORT here. GesturePoint isn't exporte
tdresser 2012/02/02 22:25:42 AURA_EXPORT is necessary for the unit tests to run
sadrul 2012/02/02 22:31:10 Aah, OK. Makes sense.
16 public:
17 explicit VelocityCalculator(int bufferSize);
18 ~VelocityCalculator();
19 void PointSeen(int x, int y, int64 time);
20 float XVelocity();
21 float YVelocity();
22 float VelocitySquared();
23 void ClearHistory();
24
25 private:
26 struct Point {
27 int x;
28 int y;
29 int64 time;
30 };
31
32 void UpdateVelocity();
33
34 typedef Point* HistoryBuffer;
35 HistoryBuffer buffer_;
sadrul 2012/02/02 22:04:06 Use a scoped_ptr here so you don't have to explici
36
37 // index_ points directly after the last point added
38 int index_;
39 size_t num_valid_entries_;
40 const size_t buffer_size_;
41 float x_velocity_;
42 float y_velocity_;
43 bool velocities_stale_;
sadrul 2012/02/02 22:04:06 DISALLOW_COPY_AND_ASSIGN(VelocityCalculator);
44 };
45 } // namespace aura
sadrul 2012/02/02 22:04:06 newline after line-44
46
47 #endif // UI_AURA_GESTURES_VELOCITY_CALCULATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698