OLD | NEW |
---|---|
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 <map> | |
8 #include <string> | 9 #include <string> |
9 #include <vector> | 10 #include <vector> |
10 | 11 |
11 #include "ash/ash_export.h" | 12 #include "ash/ash_export.h" |
12 #include "ui/display/types/display_constants.h" | 13 #include "ui/display/types/display_constants.h" |
13 #include "ui/gfx/display.h" | 14 #include "ui/gfx/display.h" |
14 #include "ui/gfx/geometry/insets.h" | 15 #include "ui/gfx/geometry/insets.h" |
15 #include "ui/gfx/geometry/rect.h" | 16 #include "ui/gfx/geometry/rect.h" |
16 | 17 |
17 namespace ash { | 18 namespace ash { |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
96 | 97 |
97 int64 id() const { return id_; } | 98 int64 id() const { return id_; } |
98 | 99 |
99 // The name of the display. | 100 // The name of the display. |
100 const std::string& name() const { return name_; } | 101 const std::string& name() const { return name_; } |
101 | 102 |
102 // True if the display EDID has the overscan flag. This does not create the | 103 // True if the display EDID has the overscan flag. This does not create the |
103 // actual overscan automatically, but used in the message. | 104 // actual overscan automatically, but used in the message. |
104 bool has_overscan() const { return has_overscan_; } | 105 bool has_overscan() const { return has_overscan_; } |
105 | 106 |
106 void set_rotation(gfx::Display::Rotation rotation) { rotation_ = rotation; } | |
107 gfx::Display::Rotation rotation() const { return rotation_; } | |
108 | |
109 void set_touch_support(gfx::Display::TouchSupport support) { | 107 void set_touch_support(gfx::Display::TouchSupport support) { |
110 touch_support_ = support; | 108 touch_support_ = support; |
111 } | 109 } |
112 gfx::Display::TouchSupport touch_support() const { return touch_support_; } | 110 gfx::Display::TouchSupport touch_support() const { return touch_support_; } |
113 | 111 |
114 void set_touch_device_id(int id) { touch_device_id_ = id; } | 112 void set_touch_device_id(int id) { touch_device_id_ = id; } |
115 int touch_device_id() const { return touch_device_id_; } | 113 int touch_device_id() const { return touch_device_id_; } |
116 | 114 |
117 // Gets/Sets the device scale factor of the display. | 115 // Gets/Sets the device scale factor of the display. |
118 float device_scale_factor() const { return device_scale_factor_; } | 116 float device_scale_factor() const { return device_scale_factor_; } |
(...skipping 13 matching lines...) Expand all Loading... | |
132 const gfx::Insets& overscan_insets_in_dip() const { | 130 const gfx::Insets& overscan_insets_in_dip() const { |
133 return overscan_insets_in_dip_; | 131 return overscan_insets_in_dip_; |
134 } | 132 } |
135 | 133 |
136 // Sets/gets configured ui scale. This can be different from the ui | 134 // Sets/gets configured ui scale. This can be different from the ui |
137 // scale actually used when the scale is 2.0 and DSF is 2.0. | 135 // scale actually used when the scale is 2.0 and DSF is 2.0. |
138 // (the effective ui scale is 1.0 in this case). | 136 // (the effective ui scale is 1.0 in this case). |
139 float configured_ui_scale() const { return configured_ui_scale_; } | 137 float configured_ui_scale() const { return configured_ui_scale_; } |
140 void set_configured_ui_scale(float scale) { configured_ui_scale_ = scale; } | 138 void set_configured_ui_scale(float scale) { configured_ui_scale_ = scale; } |
141 | 139 |
140 // Sets the rotation for the given |source|. Setting a new rotation will also | |
141 // have it become the active rotation. | |
142 void SetRotation(gfx::Display::Rotation rotation, | |
143 gfx::Display::RotationSource source); | |
144 | |
145 // Returns the currently active rotation for this display. | |
146 gfx::Display::Rotation ActiveRotation() const; | |
oshima
2015/04/17 17:52:44
GetActiveRotation()
jonross
2015/04/17 19:40:04
Done.
| |
147 | |
148 // Returns the rotation set by a given |source|. | |
149 gfx::Display::Rotation GetRotation(gfx::Display::RotationSource source) const; | |
150 | |
142 // Returns the ui scale and device scale factor actually used to create | 151 // Returns the ui scale and device scale factor actually used to create |
143 // display that chrome sees. This can be different from one obtained | 152 // display that chrome sees. This can be different from one obtained |
144 // from dispaly or one specified by a user in following situation. | 153 // from dispaly or one specified by a user in following situation. |
145 // 1) DSF is 2.0f and UI scale is 2.0f. (Returns 1.0f and 1.0f respectiely) | 154 // 1) DSF is 2.0f and UI scale is 2.0f. (Returns 1.0f and 1.0f respectiely) |
146 // 2) A user specified 0.8x on the device that has 1.25 DSF. 1.25 DSF device | 155 // 2) A user specified 0.8x on the device that has 1.25 DSF. 1.25 DSF device |
147 // uses 1.0f DFS unless 0.8x UI scaling is specified. | 156 // uses 1.0f DFS unless 0.8x UI scaling is specified. |
148 float GetEffectiveDeviceScaleFactor() const; | 157 float GetEffectiveDeviceScaleFactor() const; |
149 | 158 |
150 // Returns the ui scale used for the device scale factor. This | 159 // Returns the ui scale used for the device scale factor. This |
151 // return 1.0f if the ui scale and dsf are both set to 2.0. | 160 // return 1.0f if the ui scale and dsf are both set to 2.0. |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
224 std::string ToFullString() const; | 233 std::string ToFullString() const; |
225 | 234 |
226 private: | 235 private: |
227 // Returns true if this display should use DSF=1.25 for UI scaling; i.e. | 236 // Returns true if this display should use DSF=1.25 for UI scaling; i.e. |
228 // SetUse125DSFForUIScaling(true) is called and this is the internal display. | 237 // SetUse125DSFForUIScaling(true) is called and this is the internal display. |
229 bool Use125DSFRorUIScaling() const; | 238 bool Use125DSFRorUIScaling() const; |
230 | 239 |
231 int64 id_; | 240 int64 id_; |
232 std::string name_; | 241 std::string name_; |
233 bool has_overscan_; | 242 bool has_overscan_; |
234 gfx::Display::Rotation rotation_; | 243 std::map<gfx::Display::RotationSource, gfx::Display::Rotation> rotations_; |
235 gfx::Display::TouchSupport touch_support_; | 244 gfx::Display::TouchSupport touch_support_; |
236 | 245 |
237 // If the display is also a touch device, it will have a positive | 246 // If the display is also a touch device, it will have a positive |
238 // |touch_device_id_|. Otherwise |touch_device_id_| is 0. | 247 // |touch_device_id_|. Otherwise |touch_device_id_| is 0. |
239 int touch_device_id_; | 248 int touch_device_id_; |
240 | 249 |
241 // This specifies the device's pixel density. (For example, a | 250 // This specifies the device's pixel density. (For example, a |
242 // display whose DPI is higher than the threshold is considered to have | 251 // display whose DPI is higher than the threshold is considered to have |
243 // device_scale_factor = 2.0 on Chrome OS). This is used by the | 252 // device_scale_factor = 2.0 on Chrome OS). This is used by the |
244 // grapics layer to choose and draw appropriate images and scale | 253 // grapics layer to choose and draw appropriate images and scale |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
279 | 288 |
280 // The list of available variations for the color calibration. | 289 // The list of available variations for the color calibration. |
281 std::vector<ui::ColorCalibrationProfile> available_color_profiles_; | 290 std::vector<ui::ColorCalibrationProfile> available_color_profiles_; |
282 | 291 |
283 // If you add a new member, you need to update Copy(). | 292 // If you add a new member, you need to update Copy(). |
284 }; | 293 }; |
285 | 294 |
286 } // namespace ash | 295 } // namespace ash |
287 | 296 |
288 #endif // ASH_DISPLAY_DISPLAY_INFO_H_ | 297 #endif // ASH_DISPLAY_DISPLAY_INFO_H_ |
OLD | NEW |