| Index: ui/events/ozone/evdev/touch_noise/single_position_touch_noise_filter.h
|
| diff --git a/ui/events/ozone/evdev/touch_noise/single_position_touch_noise_filter.h b/ui/events/ozone/evdev/touch_noise/single_position_touch_noise_filter.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..16457cb74fde208c40ffab6981387e23c34fb779
|
| --- /dev/null
|
| +++ b/ui/events/ozone/evdev/touch_noise/single_position_touch_noise_filter.h
|
| @@ -0,0 +1,51 @@
|
| +// Copyright 2015 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_EVENTS_OZONE_EVDEV_SINGLE_POSITION_TOUCH_NOISE_FILTER_H_
|
| +#define UI_EVENTS_OZONE_EVDEV_SINGLE_POSITION_TOUCH_NOISE_FILTER_H_
|
| +
|
| +#include "base/macros.h"
|
| +#include "base/time/time.h"
|
| +#include "ui/events/ozone/evdev/touch_noise/touch_noise_filter.h"
|
| +#include "ui/gfx/geometry/point_f.h"
|
| +
|
| +namespace ui {
|
| +
|
| +class SinglePositionTouchNoiseFilter : public TouchNoiseFilter {
|
| + public:
|
| + SinglePositionTouchNoiseFilter();
|
| + ~SinglePositionTouchNoiseFilter() override {}
|
| +
|
| + // TouchNoiseFilter:
|
| + void FilterFrame(Frame* previous, Frame* next) override;
|
| +
|
| + private:
|
| + struct Touch {
|
| + Touch();
|
| + ~Touch();
|
| +
|
| + bool valid;
|
| + gfx::PointF location;
|
| + size_t slot;
|
| + base::TimeDelta begin;
|
| + base::TimeDelta end;
|
| + };
|
| +
|
| + void StopTrackingTouch(size_t index);
|
| + void TrackTouch(size_t slot, Frame* frame);
|
| +
|
| + // A mapping of slot to tracked touch index in |tracked_touches_|.
|
| + size_t tracked_slots_[kNumSlots];
|
| +
|
| + // A circular buffer of tracked touches [|touches_start_|, |touches_end_|).
|
| + static const int kNumTrackedTouches = 100;
|
| + Touch tracked_touches_[kNumTrackedTouches];
|
| +
|
| + size_t touches_start_;
|
| + size_t touches_end_;
|
| +};
|
| +
|
| +} // namespace touch_noise_filter
|
| +
|
| +#endif // SINGLE_POSITION_FILTER_H__
|
|
|