Index: ash/display/display_info.cc |
diff --git a/ash/display/display_info.cc b/ash/display/display_info.cc |
index d35f0fc0329895e10544afb84d9f64d7bdb6d190..aa04ef161bddb98c16ac814ec91331cafad2aa0b 100644 |
--- a/ash/display/display_info.cc |
+++ b/ash/display/display_info.cc |
@@ -23,10 +23,12 @@ |
namespace ash { |
namespace internal { |
-Resolution::Resolution(const gfx::Size& size, bool interlaced) |
- : size(size), |
- interlaced(interlaced) { |
-} |
+Resolution::Resolution() : refresh_rate(0.0f), interlaced(false) {} |
+ |
+Resolution::Resolution(const gfx::Size& size, |
+ float refresh_rate, |
+ bool interlaced) |
+ : size(size), refresh_rate(refresh_rate), interlaced(interlaced) {} |
// satic |
DisplayInfo DisplayInfo::CreateFromSpec(const std::string& spec) { |
@@ -112,8 +114,14 @@ DisplayInfo DisplayInfo::CreateFromSpecWithID(const std::string& spec, |
for (size_t i = 0; i < count; ++i) { |
std::string resolution = parts[i]; |
int width, height; |
- if (sscanf(resolution.c_str(), "%dx%d", &width, &height) == 2) |
- resolutions.push_back(Resolution(gfx::Size(width, height), false)); |
+ float refresh_rate = 0.0f; |
+ if (sscanf(resolution.c_str(), |
+ "%dx%d%%%f", |
+ &width, |
+ &height, |
+ &refresh_rate) >= 2) |
+ resolutions.push_back( |
+ Resolution(gfx::Size(width, height), refresh_rate, false)); |
} |
} |
@@ -239,9 +247,19 @@ gfx::Insets DisplayInfo::GetOverscanInsetsInPixel() const { |
std::string DisplayInfo::ToString() const { |
int rotation_degree = static_cast<int>(rotation_) * 90; |
+ std::string resolutions; |
+ std::vector<Resolution>::const_iterator iter; |
+ for (iter = resolutions_.begin(); iter != resolutions_.end(); ++iter) { |
+ base::StringAppendF(&resolutions, |
+ "(%dx%d@%f%c), ", |
+ iter->size.width(), |
+ iter->size.height(), |
+ iter->refresh_rate, |
+ iter->interlaced ? 'I' : 'P'); |
+ } |
return base::StringPrintf( |
"DisplayInfo[%lld] native bounds=%s, size=%s, scale=%f, " |
- "overscan=%s, rotation=%d, ui-scale=%f, touchscreen=%s", |
+ "overscan=%s, rotation=%d, ui-scale=%f, touchscreen=%s, resolutions=[%s]", |
static_cast<long long int>(id_), |
bounds_in_native_.ToString().c_str(), |
size_in_pixel_.ToString().c_str(), |
@@ -249,9 +267,12 @@ std::string DisplayInfo::ToString() const { |
overscan_insets_in_dip_.ToString().c_str(), |
rotation_degree, |
configured_ui_scale_, |
- touch_support_ == gfx::Display::TOUCH_SUPPORT_AVAILABLE ? "yes" : |
- touch_support_ == gfx::Display::TOUCH_SUPPORT_UNAVAILABLE ? "no" : |
- "unknown"); |
+ touch_support_ == gfx::Display::TOUCH_SUPPORT_AVAILABLE |
+ ? "yes" |
+ : touch_support_ == gfx::Display::TOUCH_SUPPORT_UNAVAILABLE |
+ ? "no" |
+ : "unknown", |
+ resolutions.c_str()); |
} |
std::string DisplayInfo::ToFullString() const { |