OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef ASH_TOUCH_TOUCH_TRANSFORMER_CONTROLLER_H_ | 5 #ifndef ASH_TOUCH_TOUCH_TRANSFORMER_CONTROLLER_H_ |
6 #define ASH_TOUCH_TOUCH_TRANSFORMER_CONTROLLER_H_ | 6 #define ASH_TOUCH_TOUCH_TRANSFORMER_CONTROLLER_H_ |
7 | 7 |
8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
9 #include "ash/display/display_controller.h" | 9 #include "ash/display/display_controller.h" |
10 #include "ui/gfx/transform.h" | 10 #include "ui/gfx/transform.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 private: | 34 private: |
35 FRIEND_TEST_ALL_PREFIXES(TouchTransformerControllerTest, | 35 FRIEND_TEST_ALL_PREFIXES(TouchTransformerControllerTest, |
36 TouchTransformerMirrorModeLetterboxing); | 36 TouchTransformerMirrorModeLetterboxing); |
37 FRIEND_TEST_ALL_PREFIXES(TouchTransformerControllerTest, | 37 FRIEND_TEST_ALL_PREFIXES(TouchTransformerControllerTest, |
38 TouchTransformerMirrorModePillarboxing); | 38 TouchTransformerMirrorModePillarboxing); |
39 FRIEND_TEST_ALL_PREFIXES(TouchTransformerControllerTest, | 39 FRIEND_TEST_ALL_PREFIXES(TouchTransformerControllerTest, |
40 TouchTransformerExtendedMode); | 40 TouchTransformerExtendedMode); |
41 FRIEND_TEST_ALL_PREFIXES(TouchTransformerControllerTest, | 41 FRIEND_TEST_ALL_PREFIXES(TouchTransformerControllerTest, |
42 TouchRadiusScale); | 42 TouchRadiusScale); |
43 | 43 |
44 bool ShouldComputeMirrorModeTouchTransformer( | 44 // Returns a transform that will be used to change an event's location from |
45 const DisplayInfo& touch_display) const ; | 45 // the touchscreen's coordinate system into the display's coordinate system. |
46 | 46 // The transform is also responsible for properly scaling the display if the |
47 gfx::Transform GetMirrorModeTouchTransformer( | 47 // display support panel fitting. |
48 const DisplayInfo& touch_display) const; | 48 // |
49 | 49 // On X11 events are reported in framebuffer coordinate space, so the |
50 gfx::Transform GetExtendedModeTouchTransformer( | 50 // |framebuffer_size| is used for scaling. |
51 const DisplayInfo& touch_display, const gfx::Size& fb_size) const; | 51 // On Ozone events are reported in the touchscreen's resolution, so |
| 52 // |touchscreen| is used to determine the size and scale the event. |
| 53 gfx::Transform GetTouchTransform( |
| 54 const DisplayInfo& display, |
| 55 const ui::TouchscreenDevice& touchscreen, |
| 56 const gfx::Size& framebuffer_size) const; |
52 | 57 |
53 // Returns the scaling factor for the touch radius such that it scales the | 58 // Returns the scaling factor for the touch radius such that it scales the |
54 // radius from |touch_device|'s coordiante system to the |touch_display|'s | 59 // radius from |touch_device|'s coordiante system to the |touch_display|'s |
55 // coordinate system. | 60 // coordinate system. |
56 double GetTouchResolutionScale( | 61 double GetTouchResolutionScale( |
57 const DisplayInfo& touch_display, | 62 const DisplayInfo& touch_display, |
58 const ui::TouchscreenDevice& touch_device) const; | 63 const ui::TouchscreenDevice& touch_device) const; |
59 | 64 |
60 // For unittests only. | |
61 bool force_compute_mirror_mode_touch_transformer_; | |
62 | |
63 DISALLOW_COPY_AND_ASSIGN(TouchTransformerController); | 65 DISALLOW_COPY_AND_ASSIGN(TouchTransformerController); |
64 }; | 66 }; |
65 | 67 |
66 } // namespace ash | 68 } // namespace ash |
67 | 69 |
68 #endif // ASH_TOUCH_TOUCH_TRANSFORMER_CONTROLLER_H_ | 70 #endif // ASH_TOUCH_TOUCH_TRANSFORMER_CONTROLLER_H_ |
OLD | NEW |