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

Unified Diff: ash/display/display_info.cc

Issue 455443002: Remember the configured device scale factor for external displays. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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
Index: ash/display/display_info.cc
diff --git a/ash/display/display_info.cc b/ash/display/display_info.cc
index bffaf3e3516f46353667354c16ef4fca4274b5f8..761f184743d5b2bc0e3a6016aaa22120edd1ce55 100644
--- a/ash/display/display_info.cc
+++ b/ash/display/display_info.cc
@@ -153,6 +153,14 @@ DisplayInfo DisplayInfo::CreateFromSpecWithID(const std::string& spec,
std::string resolution = parts[i];
int width, height;
float refresh_rate = 0.0f;
+ float device_scale_factor = 1.0f;
+ size_t asterisk_pos = resolution.find("*");
+ if (asterisk_pos != std::string::npos) {
+ sscanf(resolution.substr(asterisk_pos + 1).c_str(),
+ "%f",
+ &device_scale_factor);
+ resolution = resolution.substr(0, asterisk_pos);
+ }
if (sscanf(resolution.c_str(),
"%dx%d%%%f",
&width,
@@ -165,8 +173,9 @@ DisplayInfo DisplayInfo::CreateFromSpecWithID(const std::string& spec,
highest_refresh_rate = refresh_rate;
native_mode = i;
}
- display_modes.push_back(
- DisplayMode(gfx::Size(width, height), refresh_rate, false, false));
+ DisplayMode mode(gfx::Size(width, height), refresh_rate, false, false);
+ mode.device_scale_factor = device_scale_factor;
+ display_modes.push_back(mode);
}
}
display_modes[native_mode].native = true;

Powered by Google App Engine
This is Rietveld 408576698