Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(632)

Side by Side Diff: ui/display/manager/managed_display_info.h

Issue 2540383002: Updates display manager and display preferences to handle touch calibration data. (Closed)
Patch Set: missing nits Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 UI_DISPLAY_MANAGER_MANAGED_DISPLAY_INFO_H_ 5 #ifndef UI_DISPLAY_MANAGER_MANAGED_DISPLAY_INFO_H_
6 #define UI_DISPLAY_MANAGER_MANAGED_DISPLAY_INFO_H_ 6 #define UI_DISPLAY_MANAGER_MANAGED_DISPLAY_INFO_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <array> 10 #include <array>
(...skipping 16 matching lines...) Expand all
27 struct DISPLAY_EXPORT TouchCalibrationData { 27 struct DISPLAY_EXPORT TouchCalibrationData {
28 // CalibrationPointPair.first -> display point 28 // CalibrationPointPair.first -> display point
29 // CalibrationPointPair.second -> touch point 29 // CalibrationPointPair.second -> touch point
30 using CalibrationPointPair = std::pair<gfx::Point, gfx::Point>; 30 using CalibrationPointPair = std::pair<gfx::Point, gfx::Point>;
31 using CalibrationPointPairQuad = std::array<CalibrationPointPair, 4>; 31 using CalibrationPointPairQuad = std::array<CalibrationPointPair, 4>;
32 TouchCalibrationData(); 32 TouchCalibrationData();
33 TouchCalibrationData(const CalibrationPointPairQuad& point_pairs, 33 TouchCalibrationData(const CalibrationPointPairQuad& point_pairs,
34 const gfx::Size& bounds); 34 const gfx::Size& bounds);
35 TouchCalibrationData(const TouchCalibrationData& calibration_data); 35 TouchCalibrationData(const TouchCalibrationData& calibration_data);
36 36
37 bool operator==(TouchCalibrationData other) const {
38 if (bounds != other.bounds)
39 return false;
40 bool checked[4] = {false};
41 size_t match = 0;
42 // The Calibration point pairs need not be in order.
43 for (size_t row = 0; row < point_pairs.size(); row++) {
44 for (size_t o_row=0; o_row < other.point_pairs.size(); o_row++) {
oshima 2016/12/02 22:33:41 shouldn't this always be paint_pairs.size() == oth
malaykeshav 2016/12/03 02:01:28 Done
45 if (checked[o_row])
46 continue;
47 if (other.point_pairs[o_row].first == point_pairs[row].first &&
48 other.point_pairs[o_row].second == point_pairs[row].second) {
49 checked[o_row] = true;
50 match++;
51 break;
52 }
53 }
54 }
55 return match == point_pairs.size();
56 }
57
37 // Calibration point pairs used during calibration. Each point pair contains a 58 // Calibration point pairs used during calibration. Each point pair contains a
38 // display point and the corresponding touch point. 59 // display point and the corresponding touch point.
39 CalibrationPointPairQuad point_pairs; 60 CalibrationPointPairQuad point_pairs;
40 61
41 // Bounds of the touch display when the calibration was performed. 62 // Bounds of the touch display when the calibration was performed.
42 gfx::Size bounds; 63 gfx::Size bounds;
43 }; 64 };
44 65
45 // A class that represents the display's mode info. 66 // A class that represents the display's mode info.
46 class DISPLAY_EXPORT ManagedDisplayMode 67 class DISPLAY_EXPORT ManagedDisplayMode
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 // If you add a new member, you need to update Copy(). 412 // If you add a new member, you need to update Copy().
392 }; 413 };
393 414
394 // Resets the synthesized display id for testing. This 415 // Resets the synthesized display id for testing. This
395 // is necessary to avoid overflowing the output index. 416 // is necessary to avoid overflowing the output index.
396 void DISPLAY_EXPORT ResetDisplayIdForTest(); 417 void DISPLAY_EXPORT ResetDisplayIdForTest();
397 418
398 } // namespace display 419 } // namespace display
399 420
400 #endif // UI_DISPLAY_MANAGER_MANAGED_DISPLAY_INFO_H_ 421 #endif // UI_DISPLAY_MANAGER_MANAGED_DISPLAY_INFO_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698