OLD | NEW |
| (Empty) |
1 // Copyright 2017 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_DISPLAY_MANAGER_CHROMEOS_MOJO_TOUCH_DEVICE_TRANSFORM_STRUCT_TRAITS_H_ | |
6 #define UI_DISPLAY_MANAGER_CHROMEOS_MOJO_TOUCH_DEVICE_TRANSFORM_STRUCT_TRAITS_H_ | |
7 | |
8 #include <stdint.h> | |
9 | |
10 #include "ui/display/manager/chromeos/mojo/touch_device_transform.mojom.h" | |
11 #include "ui/display/manager/chromeos/touch_device_transform.h" | |
12 #include "ui/gfx/mojo/transform_struct_traits.h" | |
13 | |
14 namespace mojo { | |
15 | |
16 template <> | |
17 struct StructTraits<display::mojom::TouchDeviceTransformDataView, | |
18 display::TouchDeviceTransform> { | |
19 public: | |
20 static int64_t display_id(const display::TouchDeviceTransform& r) { | |
21 return r.display_id; | |
22 } | |
23 static int32_t device_id(const display::TouchDeviceTransform& r) { | |
24 return r.device_id; | |
25 } | |
26 static const gfx::Transform& transform( | |
27 const display::TouchDeviceTransform& r) { | |
28 return r.transform; | |
29 } | |
30 | |
31 static bool Read(display::mojom::TouchDeviceTransformDataView data, | |
32 display::TouchDeviceTransform* out) { | |
33 out->display_id = data.display_id(); | |
34 out->device_id = data.device_id(); | |
35 if (!data.ReadTransform(&(out->transform))) | |
36 return false; | |
37 return true; | |
38 } | |
39 }; | |
40 | |
41 } // namespace mojo | |
42 | |
43 #endif // UI_DISPLAY_MANAGER_CHROMEOS_MOJO_TOUCH_DEVICE_TRANSFORM_STRUCT_TRAITS
_H_ | |
OLD | NEW |