summaryrefslogtreecommitdiffstats
path: root/ui/events/gesture_detection/gesture_event_data.cc
blob: 2102f230c7a700a90bd0434d3435ffd70b164f26 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// Copyright 2014 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.

#include "ui/events/gesture_detection/gesture_event_data.h"

#include "base/logging.h"

namespace ui {

GestureEventData::GestureEventData(const GestureEventDetails& details,
                                   int motion_event_id,
                                   MotionEvent::ToolType primary_tool_type,
                                   base::TimeTicks time,
                                   float x,
                                   float y,
                                   float raw_x,
                                   float raw_y,
                                   size_t touch_point_count,
                                   const gfx::RectF& bounding_box,
                                   int flags)
    : details(details),
      motion_event_id(motion_event_id),
      primary_tool_type(primary_tool_type),
      time(time),
      x(x),
      y(y),
      raw_x(raw_x),
      raw_y(raw_y),
      flags(flags) {
  DCHECK_GE(motion_event_id, 0);
  DCHECK_NE(0U, touch_point_count);
  this->details.set_touch_points(static_cast<int>(touch_point_count));
  this->details.set_bounding_box(bounding_box);
}

GestureEventData::GestureEventData(EventType type,
                                   const GestureEventData& other)
    : details(type),
      motion_event_id(other.motion_event_id),
      primary_tool_type(other.primary_tool_type),
      time(other.time),
      x(other.x),
      y(other.y),
      raw_x(other.raw_x),
      raw_y(other.raw_y),
      flags(other.flags) {
  details.set_touch_points(other.details.touch_points());
  details.set_bounding_box(other.details.bounding_box_f());
}

GestureEventData::GestureEventData()
    : motion_event_id(0),
      primary_tool_type(MotionEvent::TOOL_TYPE_UNKNOWN),
      x(0),
      y(0),
      raw_x(0),
      raw_y(0),
      flags(EF_NONE) {
}

}  //  namespace ui