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 UI_DISPLAY_TYPES_DISPLAY_SNAPSHOT_H_ | 5 #ifndef UI_DISPLAY_TYPES_DISPLAY_SNAPSHOT_H_ |
6 #define UI_DISPLAY_TYPES_DISPLAY_SNAPSHOT_H_ | 6 #define UI_DISPLAY_TYPES_DISPLAY_SNAPSHOT_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "ui/display/types/display_constants.h" | 14 #include "ui/display/types/display_constants.h" |
15 #include "ui/display/types/display_mode.h" | 15 #include "ui/display/types/display_mode.h" |
16 #include "ui/gfx/buffer_types.h" | 16 #include "ui/gfx/buffer_types.h" |
17 #include "ui/gfx/geometry/point.h" | 17 #include "ui/gfx/geometry/point.h" |
18 #include "ui/gfx/geometry/size.h" | 18 #include "ui/gfx/geometry/size.h" |
19 | 19 |
20 namespace ui { | 20 namespace ui { |
21 | 21 |
22 // This class represents the state of a display at one point in time. Platforms | 22 // This class represents the state of a display at one point in time. Platforms |
23 // will extend this class in order to add platform specific configuration and | 23 // will extend this class in order to add platform specific configuration and |
24 // identifiers required to configure this display. | 24 // identifiers required to configure this display. |
25 class DISPLAY_TYPES_EXPORT DisplaySnapshot { | 25 class DISPLAY_TYPES_EXPORT DisplaySnapshot { |
26 public: | 26 public: |
| 27 using DisplayModeList = std::vector<std::unique_ptr<const DisplayMode>>; |
| 28 |
27 DisplaySnapshot(int64_t display_id, | 29 DisplaySnapshot(int64_t display_id, |
28 const gfx::Point& origin, | 30 const gfx::Point& origin, |
29 const gfx::Size& physical_size, | 31 const gfx::Size& physical_size, |
30 DisplayConnectionType type, | 32 DisplayConnectionType type, |
31 bool is_aspect_preserving_scaling, | 33 bool is_aspect_preserving_scaling, |
32 bool has_overscan, | 34 bool has_overscan, |
33 bool has_color_correction_matrix, | 35 bool has_color_correction_matrix, |
34 std::string display_name, | 36 std::string display_name, |
35 const base::FilePath& sys_path, | 37 const base::FilePath& sys_path, |
36 std::vector<std::unique_ptr<const DisplayMode>> modes, | 38 DisplayModeList modes, |
37 const std::vector<uint8_t>& edid, | 39 const std::vector<uint8_t>& edid, |
38 const DisplayMode* current_mode, | 40 const DisplayMode* current_mode, |
39 const DisplayMode* native_mode); | 41 const DisplayMode* native_mode); |
40 virtual ~DisplaySnapshot(); | 42 virtual ~DisplaySnapshot(); |
41 | 43 |
42 const gfx::Point& origin() const { return origin_; } | 44 const gfx::Point& origin() const { return origin_; } |
43 const gfx::Size& physical_size() const { return physical_size_; } | 45 const gfx::Size& physical_size() const { return physical_size_; } |
44 ui::DisplayConnectionType type() const { return type_; } | 46 ui::DisplayConnectionType type() const { return type_; } |
45 bool is_aspect_preserving_scaling() const { | 47 bool is_aspect_preserving_scaling() const { |
46 return is_aspect_preserving_scaling_; | 48 return is_aspect_preserving_scaling_; |
47 } | 49 } |
48 bool has_overscan() const { return has_overscan_; } | 50 bool has_overscan() const { return has_overscan_; } |
49 std::string display_name() const { return display_name_; } | 51 std::string display_name() const { return display_name_; } |
50 const base::FilePath& sys_path() const { return sys_path_; } | 52 const base::FilePath& sys_path() const { return sys_path_; } |
51 | 53 |
52 int64_t display_id() const { return display_id_; } | 54 int64_t display_id() const { return display_id_; } |
53 | 55 |
54 const DisplayMode* current_mode() const { return current_mode_; } | 56 const DisplayMode* current_mode() const { return current_mode_; } |
55 const DisplayMode* native_mode() const { return native_mode_; } | 57 const DisplayMode* native_mode() const { return native_mode_; } |
56 int64_t product_id() const { return product_id_; } | 58 int64_t product_id() const { return product_id_; } |
57 const gfx::Size& maximum_cursor_size() const { return maximum_cursor_size_; } | 59 const gfx::Size& maximum_cursor_size() const { return maximum_cursor_size_; } |
58 | 60 |
59 const std::vector<std::unique_ptr<const DisplayMode>>& modes() const { | 61 const DisplayModeList& modes() const { return modes_; } |
60 return modes_; | |
61 } | |
62 const std::vector<uint8_t>& edid() const { return edid_; } | 62 const std::vector<uint8_t>& edid() const { return edid_; } |
63 | 63 |
64 void set_current_mode(const DisplayMode* mode) { current_mode_ = mode; } | 64 void set_current_mode(const DisplayMode* mode) { current_mode_ = mode; } |
65 void set_origin(const gfx::Point& origin) { origin_ = origin; } | 65 void set_origin(const gfx::Point& origin) { origin_ = origin; } |
66 void add_mode(const DisplayMode* mode) { | 66 void add_mode(const DisplayMode* mode) { |
67 modes_.push_back(mode->Clone()); | 67 modes_.push_back(mode->Clone()); |
68 } | 68 } |
69 | 69 |
70 // Whether this display has advanced color correction available. | 70 // Whether this display has advanced color correction available. |
71 bool has_color_correction_matrix() const { | 71 bool has_color_correction_matrix() const { |
(...skipping 23 matching lines...) Expand all Loading... |
95 bool is_aspect_preserving_scaling_; | 95 bool is_aspect_preserving_scaling_; |
96 | 96 |
97 bool has_overscan_; | 97 bool has_overscan_; |
98 | 98 |
99 bool has_color_correction_matrix_; | 99 bool has_color_correction_matrix_; |
100 | 100 |
101 std::string display_name_; | 101 std::string display_name_; |
102 | 102 |
103 base::FilePath sys_path_; | 103 base::FilePath sys_path_; |
104 | 104 |
105 std::vector<std::unique_ptr<const DisplayMode>> modes_; | 105 DisplayModeList modes_; |
106 | 106 |
107 // The display's EDID. It can be empty if nothing extracted such as in the | 107 // The display's EDID. It can be empty if nothing extracted such as in the |
108 // case of a virtual display. | 108 // case of a virtual display. |
109 std::vector<uint8_t> edid_; | 109 std::vector<uint8_t> edid_; |
110 | 110 |
111 // Mode currently being used by the output. | 111 // Mode currently being used by the output. |
112 const DisplayMode* current_mode_; | 112 const DisplayMode* current_mode_; |
113 | 113 |
114 // "Best" mode supported by the output. | 114 // "Best" mode supported by the output. |
115 const DisplayMode* native_mode_; | 115 const DisplayMode* native_mode_; |
116 | 116 |
117 // Combination of manufacturer and product code. | 117 // Combination of manufacturer and product code. |
118 int64_t product_id_; | 118 int64_t product_id_; |
119 | 119 |
120 // Maximum supported cursor size on this display. | 120 // Maximum supported cursor size on this display. |
121 gfx::Size maximum_cursor_size_; | 121 gfx::Size maximum_cursor_size_; |
122 | 122 |
| 123 private: |
123 DISALLOW_COPY_AND_ASSIGN(DisplaySnapshot); | 124 DISALLOW_COPY_AND_ASSIGN(DisplaySnapshot); |
124 }; | 125 }; |
125 | 126 |
126 } // namespace ui | 127 } // namespace ui |
127 | 128 |
128 #endif // UI_DISPLAY_TYPES_DISPLAY_SNAPSHOT_H_ | 129 #endif // UI_DISPLAY_TYPES_DISPLAY_SNAPSHOT_H_ |
OLD | NEW |