OLD | NEW |
| (Empty) |
1 // Copyright 2015 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_EVENTS_OZONE_EVDEV_TOUCH_NOISE_SINGLE_POSITION_TOUCH_NOISE_FILTER_H_ | |
6 #define UI_EVENTS_OZONE_EVDEV_TOUCH_NOISE_SINGLE_POSITION_TOUCH_NOISE_FILTER_H_ | |
7 | |
8 #include "base/macros.h" | |
9 #include "base/time/time.h" | |
10 #include "ui/events/ozone/evdev/touch_noise/touch_noise_filter.h" | |
11 | |
12 namespace ui { | |
13 | |
14 class SinglePositionTouchNoiseFilter : public TouchNoiseFilter { | |
15 public: | |
16 SinglePositionTouchNoiseFilter(); | |
17 ~SinglePositionTouchNoiseFilter() override {} | |
18 | |
19 // TouchNoiseFilter: | |
20 void Filter(const std::vector<InProgressTouchEvdev>& touches, | |
21 base::TimeDelta time, | |
22 std::bitset<kNumTouchEvdevSlots>* slots_with_noise) override; | |
23 | |
24 private: | |
25 struct TrackedTouch { | |
26 TrackedTouch(); | |
27 ~TrackedTouch(); | |
28 | |
29 bool valid; | |
30 size_t slot; | |
31 int x; | |
32 int y; | |
33 base::TimeDelta begin; | |
34 base::TimeDelta end; | |
35 }; | |
36 | |
37 void StopTrackingTouch(size_t index); | |
38 void TrackTouch(const InProgressTouchEvdev& touch, | |
39 base::TimeDelta time); | |
40 | |
41 // A mapping of slot to tracked touch index in |tracked_touches_|. | |
42 size_t tracked_slots_[kNumTouchEvdevSlots]; | |
43 | |
44 // A circular buffer of tracked touches | |
45 // [|tracked_touches_start_|, |tracked_touches_end_|). | |
46 static const int kNumTrackedTouches = 100; | |
47 TrackedTouch tracked_touches_[kNumTrackedTouches]; | |
48 | |
49 size_t tracked_touches_start_; | |
50 size_t tracked_touches_end_; | |
51 }; | |
52 | |
53 } // namespace ui | |
54 | |
55 #endif // UI_EVENTS_OZONE_EVDEV_TOUCH_NOISE_SINGLE_POSITION_TOUCH_NOISE_FILTER_
H_ | |
OLD | NEW |