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_COMMON_DISPLAY_DISPLAY_INFO_H_ | 5 #ifndef ASH_COMMON_DISPLAY_DISPLAY_INFO_H_ |
6 #define ASH_COMMON_DISPLAY_DISPLAY_INFO_H_ | 6 #define ASH_COMMON_DISPLAY_DISPLAY_INFO_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 16 matching lines...) Expand all Loading... |
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 |display::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 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 float device_scale_factor() const { return device_scale_factor_; } | 131 float device_scale_factor() const { return device_scale_factor_; } |
132 void set_device_scale_factor(float scale) { device_scale_factor_ = scale; } | 132 void set_device_scale_factor(float scale) { device_scale_factor_ = scale; } |
133 | 133 |
134 // Gets/Sets the device DPI of the display. | 134 // Gets/Sets the device DPI of the display. |
135 float device_dpi() const { return device_dpi_; } | 135 float device_dpi() const { return device_dpi_; } |
136 void set_device_dpi(float dpi) { device_dpi_ = dpi; } | 136 void set_device_dpi(float dpi) { device_dpi_ = dpi; } |
137 | 137 |
138 // The native bounds for the display. The size of this can be | 138 // The native bounds for the display. The size of this can be |
139 // different from the |size_in_pixel| when overscan insets are set | 139 // different from the |size_in_pixel| when overscan insets are set |
140 // and/or |configured_ui_scale_| is set. | 140 // and/or |configured_ui_scale_| is set. |
141 const gfx::Rect& bounds_in_native() const { | 141 const gfx::Rect& bounds_in_native() const { return bounds_in_native_; } |
142 return bounds_in_native_; | |
143 } | |
144 | 142 |
145 // The size for the display in pixels. | 143 // The size for the display in pixels. |
146 const gfx::Size& size_in_pixel() const { return size_in_pixel_; } | 144 const gfx::Size& size_in_pixel() const { return size_in_pixel_; } |
147 | 145 |
148 // The overscan insets for the display in DIP. | 146 // The overscan insets for the display in DIP. |
149 const gfx::Insets& overscan_insets_in_dip() const { | 147 const gfx::Insets& overscan_insets_in_dip() const { |
150 return overscan_insets_in_dip_; | 148 return overscan_insets_in_dip_; |
151 } | 149 } |
152 | 150 |
153 // Sets/gets configured ui scale. This can be different from the ui | 151 // Sets/gets configured ui scale. This can be different from the ui |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 return display_modes_; | 211 return display_modes_; |
214 } | 212 } |
215 // Sets the display mode list. The mode list will be sorted for the | 213 // Sets the display mode list. The mode list will be sorted for the |
216 // display. | 214 // display. |
217 void SetDisplayModes(const std::vector<DisplayMode>& display_modes); | 215 void SetDisplayModes(const std::vector<DisplayMode>& display_modes); |
218 | 216 |
219 // Returns the native mode size. If a native mode is not present, return an | 217 // Returns the native mode size. If a native mode is not present, return an |
220 // empty size. | 218 // empty size. |
221 gfx::Size GetNativeModeSize() const; | 219 gfx::Size GetNativeModeSize() const; |
222 | 220 |
223 ui::ColorCalibrationProfile color_profile() const { | 221 ui::ColorCalibrationProfile color_profile() const { return color_profile_; } |
224 return color_profile_; | |
225 } | |
226 | 222 |
227 // Sets the color profile. It will ignore if the specified |profile| is not in | 223 // Sets the color profile. It will ignore if the specified |profile| is not in |
228 // |available_color_profiles_|. | 224 // |available_color_profiles_|. |
229 void SetColorProfile(ui::ColorCalibrationProfile profile); | 225 void SetColorProfile(ui::ColorCalibrationProfile profile); |
230 | 226 |
231 // Returns true if |profile| is in |available_color_profiles_|. | 227 // Returns true if |profile| is in |available_color_profiles_|. |
232 bool IsColorProfileAvailable(ui::ColorCalibrationProfile profile) const; | 228 bool IsColorProfileAvailable(ui::ColorCalibrationProfile profile) const; |
233 | 229 |
234 const std::vector<ui::ColorCalibrationProfile>& | 230 const std::vector<ui::ColorCalibrationProfile>& available_color_profiles() |
235 available_color_profiles() const { | 231 const { |
236 return available_color_profiles_; | 232 return available_color_profiles_; |
237 } | 233 } |
238 | 234 |
239 void set_available_color_profiles( | 235 void set_available_color_profiles( |
240 const std::vector<ui::ColorCalibrationProfile>& profiles) { | 236 const std::vector<ui::ColorCalibrationProfile>& profiles) { |
241 available_color_profiles_ = profiles; | 237 available_color_profiles_ = profiles; |
242 } | 238 } |
243 | 239 |
244 bool is_aspect_preserving_scaling() const { | 240 bool is_aspect_preserving_scaling() const { |
245 return is_aspect_preserving_scaling_; | 241 return is_aspect_preserving_scaling_; |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 // If you add a new member, you need to update Copy(). | 327 // If you add a new member, you need to update Copy(). |
332 }; | 328 }; |
333 | 329 |
334 // Resets the synthesized display id for testing. This | 330 // Resets the synthesized display id for testing. This |
335 // is necessary to avoid overflowing the output index. | 331 // is necessary to avoid overflowing the output index. |
336 ASH_EXPORT void ResetDisplayIdForTest(); | 332 ASH_EXPORT void ResetDisplayIdForTest(); |
337 | 333 |
338 } // namespace ash | 334 } // namespace ash |
339 | 335 |
340 #endif // ASH_COMMON_DISPLAY_DISPLAY_INFO_H_ | 336 #endif // ASH_COMMON_DISPLAY_DISPLAY_INFO_H_ |
OLD | NEW |