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(unsigned int id) { touch_device_id_ = id; } | 112 void set_touch_device_id(unsigned int id) { touch_device_id_ = id; } |
115 unsigned int touch_device_id() const { return touch_device_id_; } | 113 unsigned 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/gets the rotation for the given |source|. Setting a new rotation will | |
141 // also have it become the active rotation. | |
142 void SetRotation(gfx::Display::Rotation rotation, | |
143 gfx::Display::RotationSource source); | |
144 gfx::Display::Rotation Rotation(gfx::Display::RotationSource source) const; | |
jonross
2015/04/10 17:54:43
Getting the active rotation is a common action.
C
tdanderson
2015/04/13 22:44:46
+1 to adding that.
jonross
2015/04/15 17:43:12
Done.
| |
145 | |
142 // Returns the ui scale and device scale factor actually used to create | 146 // Returns the ui scale and device scale factor actually used to create |
143 // display that chrome sees. This can be different from one obtained | 147 // display that chrome sees. This can be different from one obtained |
144 // from dispaly or one specified by a user in following situation. | 148 // 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) | 149 // 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 | 150 // 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. | 151 // uses 1.0f DFS unless 0.8x UI scaling is specified. |
148 float GetEffectiveDeviceScaleFactor() const; | 152 float GetEffectiveDeviceScaleFactor() const; |
149 | 153 |
150 // Returns the ui scale used for the device scale factor. This | 154 // 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. | 155 // 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; | 228 std::string ToFullString() const; |
225 | 229 |
226 private: | 230 private: |
227 // Returns true if this display should use DSF=1.25 for UI scaling; i.e. | 231 // 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. | 232 // SetUse125DSFForUIScaling(true) is called and this is the internal display. |
229 bool Use125DSFRorUIScaling() const; | 233 bool Use125DSFRorUIScaling() const; |
230 | 234 |
231 int64 id_; | 235 int64 id_; |
232 std::string name_; | 236 std::string name_; |
233 bool has_overscan_; | 237 bool has_overscan_; |
234 gfx::Display::Rotation rotation_; | 238 std::map<gfx::Display::RotationSource, gfx::Display::Rotation> rotations_; |
235 gfx::Display::TouchSupport touch_support_; | 239 gfx::Display::TouchSupport touch_support_; |
236 | 240 |
237 // If the display is also a touch device, it will have a positive | 241 // If the display is also a touch device, it will have a positive |
238 // |touch_device_id_|. Otherwise |touch_device_id_| is 0. | 242 // |touch_device_id_|. Otherwise |touch_device_id_| is 0. |
239 unsigned int touch_device_id_; | 243 unsigned int touch_device_id_; |
240 | 244 |
241 // This specifies the device's pixel density. (For example, a | 245 // This specifies the device's pixel density. (For example, a |
242 // display whose DPI is higher than the threshold is considered to have | 246 // 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 | 247 // device_scale_factor = 2.0 on Chrome OS). This is used by the |
244 // grapics layer to choose and draw appropriate images and scale | 248 // grapics layer to choose and draw appropriate images and scale |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
279 | 283 |
280 // The list of available variations for the color calibration. | 284 // The list of available variations for the color calibration. |
281 std::vector<ui::ColorCalibrationProfile> available_color_profiles_; | 285 std::vector<ui::ColorCalibrationProfile> available_color_profiles_; |
282 | 286 |
283 // If you add a new member, you need to update Copy(). | 287 // If you add a new member, you need to update Copy(). |
284 }; | 288 }; |
285 | 289 |
286 } // namespace ash | 290 } // namespace ash |
287 | 291 |
288 #endif // ASH_DISPLAY_DISPLAY_INFO_H_ | 292 #endif // ASH_DISPLAY_DISPLAY_INFO_H_ |
OLD | NEW |