| OLD | NEW |
| 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 "remoting/client/touch_input_scaler.h" | 5 #include "remoting/client/touch_input_scaler.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "remoting/proto/event.pb.h" | 8 #include "remoting/proto/event.pb.h" |
| 9 | 9 |
| 10 namespace remoting { | 10 namespace remoting { |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 // For example | 62 // For example |
| 63 // Suppose: | 63 // Suppose: |
| 64 // - No size scaling. | 64 // - No size scaling. |
| 65 // - Client is a HiDPI Chromebook device. | 65 // - Client is a HiDPI Chromebook device. |
| 66 // - Host is running on a HiDPI Windows device. | 66 // - Host is running on a HiDPI Windows device. |
| 67 // With the configuration above, the client will send the logical touch | 67 // With the configuration above, the client will send the logical touch |
| 68 // size to the host, therefore it will be smaller on the host. | 68 // size to the host, therefore it will be smaller on the host. |
| 69 // This is because a HiDPI Chromebook device (e.g. Pixel) has 2 by 2 | 69 // This is because a HiDPI Chromebook device (e.g. Pixel) has 2 by 2 |
| 70 // physical pixel mapped to a logical pixel. | 70 // physical pixel mapped to a logical pixel. |
| 71 // With scaling, the size would be the same. | 71 // With scaling, the size would be the same. |
| 72 // TODO(rkuroiwa): Also clamp. Note that point->angle() affects the maximum | 72 // Note that there's no need to clamp the touch point size. For example on |
| 73 // size (crbug.com/461526). | 73 // a Nexus4 device, part of the touch circle falls outside the screen on |
| 74 // edges but still functions correctly. |
| 74 if (point->has_radius_x() || point->has_radius_y()) { | 75 if (point->has_radius_x() || point->has_radius_y()) { |
| 75 DCHECK(point->has_radius_x() && point->has_radius_y()); | 76 DCHECK(point->has_radius_x() && point->has_radius_y()); |
| 76 point->set_radius_x( | 77 point->set_radius_x( |
| 77 Scale(point->radius_x(), output_size_.width(), input_size_.width())); | 78 Scale(point->radius_x(), output_size_.width(), input_size_.width())); |
| 78 point->set_radius_y(Scale(point->radius_y(), output_size_.height(), | 79 point->set_radius_y(Scale(point->radius_y(), output_size_.height(), |
| 79 input_size_.height())); | 80 input_size_.height())); |
| 80 } | 81 } |
| 81 } | 82 } |
| 82 | 83 |
| 83 InputFilter::InjectTouchEvent(out_event); | 84 InputFilter::InjectTouchEvent(out_event); |
| 84 } | 85 } |
| 85 | 86 |
| 86 } // namespace remoting | 87 } // namespace remoting |
| OLD | NEW |