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

Side by Side Diff: ui/events/ozone/evdev/touch_noise/horizontally_aligned_touch_noise_filter.cc

Issue 1975533002: Change ui::Event::time_stamp from TimeDelta to TimeTicks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 6 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
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/events/ozone/evdev/touch_noise/horizontally_aligned_touch_noise_fil ter.h" 5 #include "ui/events/ozone/evdev/touch_noise/horizontally_aligned_touch_noise_fil ter.h"
6 6
7 #include <inttypes.h> 7 #include <inttypes.h>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/metrics/histogram_macros.h" 11 #include "base/metrics/histogram_macros.h"
12 #include "base/strings/stringprintf.h" 12 #include "base/strings/stringprintf.h"
13 13
14 namespace ui { 14 namespace ui {
15 15
16 namespace { 16 namespace {
17 17
18 // The maximum horizontal distance between touches considered aligned. 18 // The maximum horizontal distance between touches considered aligned.
19 int kMaxDistance = 3; 19 int kMaxDistance = 3;
20 20
21 } // namespace 21 } // namespace
22 22
23 void HorizontallyAlignedTouchNoiseFilter::Filter( 23 void HorizontallyAlignedTouchNoiseFilter::Filter(
24 const std::vector<InProgressTouchEvdev>& touches, 24 const std::vector<InProgressTouchEvdev>& touches,
25 base::TimeDelta time, 25 base::TimeTicks time,
26 std::bitset<kNumTouchEvdevSlots>* slots_with_noise) { 26 std::bitset<kNumTouchEvdevSlots>* slots_with_noise) {
27 for (const InProgressTouchEvdev& touch : touches) { 27 for (const InProgressTouchEvdev& touch : touches) {
28 // Only consider new touches. 28 // Only consider new touches.
29 if (!touch.touching || touch.was_touching) 29 if (!touch.touching || touch.was_touching)
30 continue; 30 continue;
31 31
32 // Check if within kMaxDistance of an existing touch. 32 // Check if within kMaxDistance of an existing touch.
33 for (const InProgressTouchEvdev& other_touch : touches) { 33 for (const InProgressTouchEvdev& other_touch : touches) {
34 if (touch.slot == other_touch.slot || !other_touch.touching) 34 if (touch.slot == other_touch.slot || !other_touch.touching)
35 continue; 35 continue;
(...skipping 11 matching lines...) Expand all
47 touch.tracking_id, time.ToInternalValue(), 47 touch.tracking_id, time.ToInternalValue(),
48 touch.x, touch.y, other_touch.tracking_id, 48 touch.x, touch.y, other_touch.tracking_id,
49 other_touch.x, other_touch.y); 49 other_touch.x, other_touch.y);
50 slots_with_noise->set(touch.slot); 50 slots_with_noise->set(touch.slot);
51 } 51 }
52 } 52 }
53 } 53 }
54 } 54 }
55 55
56 } // namespace ui 56 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698