Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2288)

Unified Diff: ash/display/display_info.cc

Issue 161413002: Revert of Read compositor VSync information from platform, when possible (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/display/display_info.h ('k') | ash/display/display_info_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/display/display_info.cc
diff --git a/ash/display/display_info.cc b/ash/display/display_info.cc
index 17a1bc1f8867cbe7197f781fc9d54cb2e9797934..d35f0fc0329895e10544afb84d9f64d7bdb6d190 100644
--- a/ash/display/display_info.cc
+++ b/ash/display/display_info.cc
@@ -23,17 +23,10 @@
namespace ash {
namespace internal {
-DisplayMode::DisplayMode()
- : refresh_rate(0.0f), interlaced(false), native(false) {}
-
-DisplayMode::DisplayMode(const gfx::Size& size,
- float refresh_rate,
- bool interlaced,
- bool native)
+Resolution::Resolution(const gfx::Size& size, bool interlaced)
: size(size),
- refresh_rate(refresh_rate),
- interlaced(interlaced),
- native(native) {}
+ interlaced(interlaced) {
+}
// satic
DisplayInfo DisplayInfo::CreateFromSpec(const std::string& spec) {
@@ -111,35 +104,17 @@
#endif
}
- std::vector<DisplayMode> display_modes;
+ std::vector<Resolution> resolutions;
if (Tokenize(main_spec, "#", &parts) == 2) {
- size_t native_mode = 0;
- int largest_area = -1;
- float highest_refresh_rate = -1.0f;
main_spec = parts[0];
std::string resolution_list = parts[1];
count = Tokenize(resolution_list, "|", &parts);
for (size_t i = 0; i < count; ++i) {
std::string resolution = parts[i];
int width, height;
- float refresh_rate = 0.0f;
- if (sscanf(resolution.c_str(),
- "%dx%d%%%f",
- &width,
- &height,
- &refresh_rate) >= 2) {
- if (width * height >= largest_area &&
- refresh_rate > highest_refresh_rate) {
- // Use mode with largest area and highest refresh rate as native.
- largest_area = width * height;
- highest_refresh_rate = refresh_rate;
- native_mode = i;
- }
- display_modes.push_back(
- DisplayMode(gfx::Size(width, height), refresh_rate, false, false));
- }
+ if (sscanf(resolution.c_str(), "%dx%d", &width, &height) == 2)
+ resolutions.push_back(Resolution(gfx::Size(width, height), false));
}
- display_modes[native_mode].native = true;
}
if (id == gfx::Display::kInvalidDisplayID)
@@ -150,7 +125,7 @@
display_info.set_rotation(rotation);
display_info.set_configured_ui_scale(ui_scale);
display_info.SetBounds(bounds_in_native);
- display_info.set_display_modes(display_modes);
+ display_info.set_resolutions(resolutions);
// To test the overscan, it creates the default 5% overscan.
if (has_overscan) {
@@ -202,7 +177,7 @@
bounds_in_native_ = native_info.bounds_in_native_;
size_in_pixel_ = native_info.size_in_pixel_;
device_scale_factor_ = native_info.device_scale_factor_;
- display_modes_ = native_info.display_modes_;
+ resolutions_ = native_info.resolutions_;
touch_support_ = native_info.touch_support_;
// Copy overscan_insets_in_dip_ if it's not empty. This is for test
@@ -274,28 +249,22 @@
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");
}
std::string DisplayInfo::ToFullString() const {
- std::string display_modes_str;
- std::vector<DisplayMode>::const_iterator iter = display_modes_.begin();
- for (; iter != display_modes_.end(); ++iter) {
- if (!display_modes_str.empty())
- display_modes_str += ",";
- base::StringAppendF(&display_modes_str,
- "(%dx%d@%f%c%s)",
- iter->size.width(),
- iter->size.height(),
- iter->refresh_rate,
- iter->interlaced ? 'I' : 'P',
- iter->native ? "(N)" : "");
- }
- return ToString() + ", display_modes==" + display_modes_str;
+ std::string resolutions_str;
+ std::vector<Resolution>::const_iterator iter = resolutions_.begin();
+ for (; iter != resolutions_.end(); ++iter) {
+ if (!resolutions_str.empty())
+ resolutions_str += ",";
+ resolutions_str += iter->size.ToString();
+ if (iter->interlaced)
+ resolutions_str += "(i)";
+ }
+ return ToString() + ", resolutions=" + resolutions_str;
}
} // namespace internal
« no previous file with comments | « ash/display/display_info.h ('k') | ash/display/display_info_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698