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 #include <stdio.h> | 5 #include <stdio.h> |
6 #include <string> | 6 #include <string> |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "ash/display/display_info.h" | 9 #include "ash/display/display_info.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 | 22 |
23 namespace ash { | 23 namespace ash { |
24 namespace { | 24 namespace { |
25 | 25 |
26 // TODO(oshima): This feature is obsolete. Remove this after m38. | 26 // TODO(oshima): This feature is obsolete. Remove this after m38. |
27 bool allow_upgrade_to_high_dpi = false; | 27 bool allow_upgrade_to_high_dpi = false; |
28 | 28 |
29 } | 29 } |
30 | 30 |
31 DisplayMode::DisplayMode() | 31 DisplayMode::DisplayMode() |
32 : refresh_rate(0.0f), interlaced(false), native(false) {} | 32 : refresh_rate(0.0f), |
| 33 interlaced(false), |
| 34 native(false), |
| 35 ui_scale(1.0f), |
| 36 device_scale_factor(1.0f) {} |
33 | 37 |
34 DisplayMode::DisplayMode(const gfx::Size& size, | 38 DisplayMode::DisplayMode(const gfx::Size& size, |
35 float refresh_rate, | 39 float refresh_rate, |
36 bool interlaced, | 40 bool interlaced, |
37 bool native) | 41 bool native) |
38 : size(size), | 42 : size(size), |
39 refresh_rate(refresh_rate), | 43 refresh_rate(refresh_rate), |
40 interlaced(interlaced), | 44 interlaced(interlaced), |
41 native(native) {} | 45 native(native), |
| 46 ui_scale(1.0f), |
| 47 device_scale_factor(1.0f) {} |
| 48 |
| 49 gfx::Size DisplayMode::GetSizeInDIP() const { |
| 50 gfx::SizeF size_dip(size); |
| 51 size_dip.Scale(ui_scale); |
| 52 size_dip.Scale(1.0f / device_scale_factor); |
| 53 return gfx::ToFlooredSize(size_dip); |
| 54 } |
42 | 55 |
43 // satic | 56 // satic |
44 DisplayInfo DisplayInfo::CreateFromSpec(const std::string& spec) { | 57 DisplayInfo DisplayInfo::CreateFromSpec(const std::string& spec) { |
45 return CreateFromSpecWithID(spec, gfx::Display::kInvalidDisplayID); | 58 return CreateFromSpecWithID(spec, gfx::Display::kInvalidDisplayID); |
46 } | 59 } |
47 | 60 |
48 // static | 61 // static |
49 void DisplayInfo::SetAllowUpgradeToHighDPI(bool enable) { | 62 void DisplayInfo::SetAllowUpgradeToHighDPI(bool enable) { |
50 allow_upgrade_to_high_dpi = enable; | 63 allow_upgrade_to_high_dpi = enable; |
51 } | 64 } |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 } | 353 } |
341 | 354 |
342 bool DisplayInfo::IsColorProfileAvailable( | 355 bool DisplayInfo::IsColorProfileAvailable( |
343 ui::ColorCalibrationProfile profile) const { | 356 ui::ColorCalibrationProfile profile) const { |
344 return std::find(available_color_profiles_.begin(), | 357 return std::find(available_color_profiles_.begin(), |
345 available_color_profiles_.end(), | 358 available_color_profiles_.end(), |
346 profile) != available_color_profiles_.end(); | 359 profile) != available_color_profiles_.end(); |
347 } | 360 } |
348 | 361 |
349 } // namespace ash | 362 } // namespace ash |
OLD | NEW |