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

Side by Side Diff: ash/display/display_info.h

Issue 1924703002: Rename gfx::Display/Screen to display::Display/Screen in ash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months 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
« no previous file with comments | « ash/display/display_configuration_controller.cc ('k') | ash/display/display_info.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 ASH_DISPLAY_DISPLAY_INFO_H_ 5 #ifndef ASH_DISPLAY_DISPLAY_INFO_H_
6 #define ASH_DISPLAY_DISPLAY_INFO_H_ 6 #define ASH_DISPLAY_DISPLAY_INFO_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "ash/ash_export.h" 14 #include "ash/ash_export.h"
15 #include "base/files/file_path.h" 15 #include "base/files/file_path.h"
16 #include "ui/display/display.h"
16 #include "ui/display/types/display_constants.h" 17 #include "ui/display/types/display_constants.h"
17 #include "ui/gfx/display.h"
18 #include "ui/gfx/geometry/insets.h" 18 #include "ui/gfx/geometry/insets.h"
19 #include "ui/gfx/geometry/rect.h" 19 #include "ui/gfx/geometry/rect.h"
20 20
21 namespace ash { 21 namespace ash {
22 22
23 // A struct that represents the display's mode info. 23 // A struct that represents the display's mode info.
24 struct ASH_EXPORT DisplayMode { 24 struct ASH_EXPORT DisplayMode {
25 DisplayMode(); 25 DisplayMode();
26 DisplayMode(const gfx::Size& size, 26 DisplayMode(const gfx::Size& size,
27 float refresh_rate, 27 float refresh_rate,
28 bool interlaced, 28 bool interlaced,
29 bool native); 29 bool native);
30 30
31 // Returns the size in DIP which is visible to the user. 31 // Returns the size in DIP which is visible to the user.
32 gfx::Size GetSizeInDIP(bool is_internal) const; 32 gfx::Size GetSizeInDIP(bool is_internal) const;
33 33
34 // Returns true if |other| has same size and scale factors. 34 // Returns true if |other| has same size and scale factors.
35 bool IsEquivalent(const DisplayMode& other) const; 35 bool IsEquivalent(const DisplayMode& other) const;
36 36
37 gfx::Size size; // Physical pixel size of the display. 37 gfx::Size size; // Physical pixel size of the display.
38 float refresh_rate; // Refresh rate of the display, in Hz. 38 float refresh_rate; // Refresh rate of the display, in Hz.
39 bool interlaced; // True if mode is interlaced. 39 bool interlaced; // True if mode is interlaced.
40 bool native; // True if mode is native mode of the display. 40 bool native; // True if mode is native mode of the display.
41 float ui_scale; // The UI scale factor of the mode. 41 float ui_scale; // The UI scale factor of the mode.
42 float device_scale_factor; // The device scale factor of the mode. 42 float device_scale_factor; // The device scale factor of the mode.
43 }; 43 };
44 44
45 // DisplayInfo contains metadata for each display. This is used to 45 // DisplayInfo contains metadata for each display. This is used to
46 // create |gfx::Display| as well as to maintain extra infomation 46 // create |display::Display| as well as to maintain extra infomation
47 // to manage displays in ash environment. 47 // to manage displays in ash environment.
48 // This class is intentionally made copiable. 48 // This class is intentionally made copiable.
49 class ASH_EXPORT DisplayInfo { 49 class ASH_EXPORT DisplayInfo {
50 public: 50 public:
51 // Creates a DisplayInfo from string spec. 100+200-1440x800 creates display 51 // Creates a DisplayInfo from string spec. 100+200-1440x800 creates display
52 // whose size is 1440x800 at the location (100, 200) in host coordinates. 52 // whose size is 1440x800 at the location (100, 200) in host coordinates.
53 // The format is 53 // The format is
54 // 54 //
55 // [origin-]widthxheight[*device_scale_factor][#resolutions list] 55 // [origin-]widthxheight[*device_scale_factor][#resolutions list]
56 // [/<properties>][@ui-scale] 56 // [/<properties>][@ui-scale]
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 const std::string& name() const { return name_; } 104 const std::string& name() const { return name_; }
105 105
106 // The path to the display device in the sysfs filesystem. 106 // The path to the display device in the sysfs filesystem.
107 void set_sys_path(const base::FilePath& sys_path) { sys_path_ = sys_path; } 107 void set_sys_path(const base::FilePath& sys_path) { sys_path_ = sys_path; }
108 const base::FilePath& sys_path() const { return sys_path_; } 108 const base::FilePath& sys_path() const { return sys_path_; }
109 109
110 // True if the display EDID has the overscan flag. This does not create the 110 // True if the display EDID has the overscan flag. This does not create the
111 // actual overscan automatically, but used in the message. 111 // actual overscan automatically, but used in the message.
112 bool has_overscan() const { return has_overscan_; } 112 bool has_overscan() const { return has_overscan_; }
113 113
114 void set_touch_support(gfx::Display::TouchSupport support) { 114 void set_touch_support(display::Display::TouchSupport support) {
115 touch_support_ = support; 115 touch_support_ = support;
116 } 116 }
117 gfx::Display::TouchSupport touch_support() const { return touch_support_; } 117 display::Display::TouchSupport touch_support() const {
118 return touch_support_;
119 }
118 120
119 // Associate the input device with identifier |id| with this display. 121 // Associate the input device with identifier |id| with this display.
120 void AddInputDevice(int id); 122 void AddInputDevice(int id);
121 123
122 // Clear the list of input devices associated with this display. 124 // Clear the list of input devices associated with this display.
123 void ClearInputDevices(); 125 void ClearInputDevices();
124 126
125 // The input device ids that are associated with this display. 127 // The input device ids that are associated with this display.
126 std::vector<int> input_devices() const { return input_devices_; } 128 std::vector<int> input_devices() const { return input_devices_; }
127 129
(...skipping 21 matching lines...) Expand all
149 } 151 }
150 152
151 // Sets/gets configured ui scale. This can be different from the ui 153 // Sets/gets configured ui scale. This can be different from the ui
152 // scale actually used when the scale is 2.0 and DSF is 2.0. 154 // scale actually used when the scale is 2.0 and DSF is 2.0.
153 // (the effective ui scale is 1.0 in this case). 155 // (the effective ui scale is 1.0 in this case).
154 float configured_ui_scale() const { return configured_ui_scale_; } 156 float configured_ui_scale() const { return configured_ui_scale_; }
155 void set_configured_ui_scale(float scale) { configured_ui_scale_ = scale; } 157 void set_configured_ui_scale(float scale) { configured_ui_scale_ = scale; }
156 158
157 // Sets the rotation for the given |source|. Setting a new rotation will also 159 // Sets the rotation for the given |source|. Setting a new rotation will also
158 // have it become the active rotation. 160 // have it become the active rotation.
159 void SetRotation(gfx::Display::Rotation rotation, 161 void SetRotation(display::Display::Rotation rotation,
160 gfx::Display::RotationSource source); 162 display::Display::RotationSource source);
161 163
162 // Returns the currently active rotation for this display. 164 // Returns the currently active rotation for this display.
163 gfx::Display::Rotation GetActiveRotation() const; 165 display::Display::Rotation GetActiveRotation() const;
164 166
165 // Returns the source which set the active rotation for this display. 167 // Returns the source which set the active rotation for this display.
166 gfx::Display::RotationSource active_rotation_source() const { 168 display::Display::RotationSource active_rotation_source() const {
167 return active_rotation_source_; 169 return active_rotation_source_;
168 } 170 }
169 171
170 // Returns the rotation set by a given |source|. 172 // Returns the rotation set by a given |source|.
171 gfx::Display::Rotation GetRotation(gfx::Display::RotationSource source) const; 173 display::Display::Rotation GetRotation(
174 display::Display::RotationSource source) const;
172 175
173 // Returns the ui scale and device scale factor actually used to create 176 // Returns the ui scale and device scale factor actually used to create
174 // display that chrome sees. This can be different from one obtained 177 // display that chrome sees. This can be different from one obtained
175 // from dispaly or one specified by a user in following situation. 178 // from dispaly or one specified by a user in following situation.
176 // 1) DSF is 2.0f and UI scale is 2.0f. (Returns 1.0f and 1.0f respectiely) 179 // 1) DSF is 2.0f and UI scale is 2.0f. (Returns 1.0f and 1.0f respectiely)
177 // 2) A user specified 0.8x on the device that has 1.25 DSF. 1.25 DSF device 180 // 2) A user specified 0.8x on the device that has 1.25 DSF. 1.25 DSF device
178 // uses 1.0f DFS unless 0.8x UI scaling is specified. 181 // uses 1.0f DFS unless 0.8x UI scaling is specified.
179 float GetEffectiveDeviceScaleFactor() const; 182 float GetEffectiveDeviceScaleFactor() const;
180 183
181 // Returns the ui scale used for the device scale factor. This 184 // Returns the ui scale used for the device scale factor. This
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 265
263 private: 266 private:
264 // Returns true if this display should use DSF=1.25 for UI scaling; i.e. 267 // Returns true if this display should use DSF=1.25 for UI scaling; i.e.
265 // SetUse125DSFForUIScaling(true) is called and this is the internal display. 268 // SetUse125DSFForUIScaling(true) is called and this is the internal display.
266 bool Use125DSFForUIScaling() const; 269 bool Use125DSFForUIScaling() const;
267 270
268 int64_t id_; 271 int64_t id_;
269 std::string name_; 272 std::string name_;
270 base::FilePath sys_path_; 273 base::FilePath sys_path_;
271 bool has_overscan_; 274 bool has_overscan_;
272 std::map<gfx::Display::RotationSource, gfx::Display::Rotation> rotations_; 275 std::map<display::Display::RotationSource, display::Display::Rotation>
273 gfx::Display::RotationSource active_rotation_source_; 276 rotations_;
274 gfx::Display::TouchSupport touch_support_; 277 display::Display::RotationSource active_rotation_source_;
278 display::Display::TouchSupport touch_support_;
275 279
276 // The set of input devices associated with this display. 280 // The set of input devices associated with this display.
277 std::vector<int> input_devices_; 281 std::vector<int> input_devices_;
278 282
279 // This specifies the device's pixel density. (For example, a 283 // This specifies the device's pixel density. (For example, a
280 // display whose DPI is higher than the threshold is considered to have 284 // display whose DPI is higher than the threshold is considered to have
281 // device_scale_factor = 2.0 on Chrome OS). This is used by the 285 // device_scale_factor = 2.0 on Chrome OS). This is used by the
282 // grapics layer to choose and draw appropriate images and scale 286 // grapics layer to choose and draw appropriate images and scale
283 // layers properly. 287 // layers properly.
284 float device_scale_factor_; 288 float device_scale_factor_;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 // If you add a new member, you need to update Copy(). 331 // If you add a new member, you need to update Copy().
328 }; 332 };
329 333
330 // Resets the synthesized display id for testing. This 334 // Resets the synthesized display id for testing. This
331 // is necessary to avoid overflowing the output index. 335 // is necessary to avoid overflowing the output index.
332 ASH_EXPORT void ResetDisplayIdForTest(); 336 ASH_EXPORT void ResetDisplayIdForTest();
333 337
334 } // namespace ash 338 } // namespace ash
335 339
336 #endif // ASH_DISPLAY_DISPLAY_INFO_H_ 340 #endif // ASH_DISPLAY_DISPLAY_INFO_H_
OLDNEW
« no previous file with comments | « ash/display/display_configuration_controller.cc ('k') | ash/display/display_info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698