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 #include "ui/display/manager/chromeos/touch_transform_controller.h" | 5 #include "ui/display/manager/chromeos/touch_transform_controller.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "third_party/skia/include/core/SkMatrix44.h" | 10 #include "third_party/skia/include/core/SkMatrix44.h" |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 | 203 |
204 #if defined(USE_OZONE) | 204 #if defined(USE_OZONE) |
205 // Translate the touch so that it falls within the display bounds. This | 205 // Translate the touch so that it falls within the display bounds. This |
206 // should not be performed if the displays are mirrored. | 206 // should not be performed if the displays are mirrored. |
207 if (display.id() == touch_display.id()) { | 207 if (display.id() == touch_display.id()) { |
208 ctm.Translate(display.bounds_in_native().x(), | 208 ctm.Translate(display.bounds_in_native().x(), |
209 display.bounds_in_native().y()); | 209 display.bounds_in_native().y()); |
210 } | 210 } |
211 #endif | 211 #endif |
212 | 212 |
| 213 // If the device is currently under calibration, then do not return any |
| 214 // transform as we want to use the raw native touch input data for calibration |
| 215 if (is_calibrating_) |
| 216 return ctm; |
| 217 |
213 // If touch calibration data is unavailable, use naive approach. | 218 // If touch calibration data is unavailable, use naive approach. |
214 if (!touch_display.has_touch_calibration_data()) { | 219 if (!touch_display.has_touch_calibration_data()) { |
215 return GetUncalibratedTransform(ctm, display, touch_display, touch_area, | 220 return GetUncalibratedTransform(ctm, display, touch_display, touch_area, |
216 touch_native_size); | 221 touch_native_size); |
217 } | 222 } |
218 | 223 |
219 // The resolution at which the touch calibration was performed. | 224 // The resolution at which the touch calibration was performed. |
220 gfx::SizeF touch_calib_size(touch_display.GetTouchCalibrationData().bounds); | 225 gfx::SizeF touch_calib_size(touch_display.GetTouchCalibrationData().bounds); |
221 | 226 |
222 // Any additional transfomration that needs to be applied to the display | 227 // Any additional transfomration that needs to be applied to the display |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 // WindowTreeHost. | 362 // WindowTreeHost. |
358 UpdateTouchTransform(display1_id, display1, display1); | 363 UpdateTouchTransform(display1_id, display1, display1); |
359 UpdateTouchTransform(display2_id, display2, display2); | 364 UpdateTouchTransform(display2_id, display2, display2); |
360 return; | 365 return; |
361 } | 366 } |
362 | 367 |
363 // Single display mode. The WindowTreeHost has one associated display id. | 368 // Single display mode. The WindowTreeHost has one associated display id. |
364 UpdateTouchTransform(single_display_id, single_display, single_display); | 369 UpdateTouchTransform(single_display_id, single_display, single_display); |
365 } | 370 } |
366 | 371 |
| 372 void TouchTransformController::SetForCalibration(bool is_calibrating) { |
| 373 is_calibrating_ = is_calibrating; |
| 374 UpdateTouchTransforms(); |
| 375 } |
| 376 |
367 } // namespace display | 377 } // namespace display |
OLD | NEW |