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

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: Resolving comments 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 #include <algorithm>
10 #include <array> 10 #include <array>
11 #include <map> 11 #include <map>
12 #include <string> 12 #include <string>
13 #include <vector> 13 #include <vector>
14 14
15 #include "base/files/file_path.h" 15 #include "base/files/file_path.h"
16 #include "base/memory/ref_counted.h" 16 #include "base/memory/ref_counted.h"
17 #include "ui/display/display.h" 17 #include "ui/display/display.h"
18 #include "ui/display/display_export.h" 18 #include "ui/display/display_export.h"
19 #include "ui/display/types/display_constants.h" 19 #include "ui/display/types/display_constants.h"
20 #include "ui/gfx/geometry/insets.h" 20 #include "ui/gfx/geometry/insets.h"
21 #include "ui/gfx/geometry/rect.h" 21 #include "ui/gfx/geometry/rect.h"
22 22
23 namespace display { 23 namespace display {
24 24
25 // A struct that represents all the data required for touch calibration for the 25 // A struct that represents all the data required for touch calibration for the
26 // display. 26 // display.
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 static bool CalibrationPointPairCompare(const CalibrationPointPair& pair_1,
38 const CalibrationPointPair& pair_2) {
39 if (pair_1.first.y() < pair_2.first.y())
40 return true;
41 return pair_1.first.x() < pair_2.first.x();
42 }
43
44 bool operator==(TouchCalibrationData other) const {
45 if (bounds != other.bounds)
46 return false;
47 CalibrationPointPairQuad quad_1 = point_pairs;
48 CalibrationPointPairQuad& quad_2 = other.point_pairs;
49
50 // Make sure the point pairs are in the correct order.
51 std::sort(quad_1.begin(), quad_1.end(), CalibrationPointPairCompare);
52 std::sort(quad_2.begin(), quad_2.end(), CalibrationPointPairCompare);
53
oshima 2016/12/05 20:43:21 return quad_1 == quad_2;
malaykeshav 2016/12/05 21:53:58 Done
malaykeshav 2016/12/05 21:53:58 Done
54 for (size_t row = 0; row < quad_1.size(); row++) {
55 if (quad_1[row] != quad_2[row])
56 return false;
57 }
58 return true;
59 }
oshima 2016/12/05 20:43:21 please move to .cc.
malaykeshav 2016/12/05 21:53:58 done
60
37 // Calibration point pairs used during calibration. Each point pair contains a 61 // Calibration point pairs used during calibration. Each point pair contains a
38 // display point and the corresponding touch point. 62 // display point and the corresponding touch point.
39 CalibrationPointPairQuad point_pairs; 63 CalibrationPointPairQuad point_pairs;
40 64
41 // Bounds of the touch display when the calibration was performed. 65 // Bounds of the touch display when the calibration was performed.
42 gfx::Size bounds; 66 gfx::Size bounds;
43 }; 67 };
44 68
45 // A class that represents the display's mode info. 69 // A class that represents the display's mode info.
46 class DISPLAY_EXPORT ManagedDisplayMode 70 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(). 415 // If you add a new member, you need to update Copy().
392 }; 416 };
393 417
394 // Resets the synthesized display id for testing. This 418 // Resets the synthesized display id for testing. This
395 // is necessary to avoid overflowing the output index. 419 // is necessary to avoid overflowing the output index.
396 void DISPLAY_EXPORT ResetDisplayIdForTest(); 420 void DISPLAY_EXPORT ResetDisplayIdForTest();
397 421
398 } // namespace display 422 } // namespace display
399 423
400 #endif // UI_DISPLAY_MANAGER_MANAGED_DISPLAY_INFO_H_ 424 #endif // UI_DISPLAY_MANAGER_MANAGED_DISPLAY_INFO_H_
OLDNEW
« no previous file with comments | « ui/display/manager/display_manager.cc ('k') | ui/display/manager/managed_display_info_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698