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

Unified Diff: ash/display/display_util.cc

Issue 1263853002: Unified Desktop: Support 2xDSF display (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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_util.h ('k') | ash/display/root_window_transformers.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/display/display_util.cc
diff --git a/ash/display/display_util.cc b/ash/display/display_util.cc
index 0bf3c660d61eaa61448b52245f5ff720880bd0b2..e6c002e62ea31c9d3e9ed736738525c0e11cc854 100644
--- a/ash/display/display_util.cc
+++ b/ash/display/display_util.cc
@@ -126,17 +126,24 @@ std::vector<DisplayMode> CreateInternalDisplayModeList(
std::vector<DisplayMode> CreateUnifiedDisplayModeList(
const DisplayMode& native_mode,
- const std::set<float>& scales) {
+ const std::set<std::pair<float, float>>& dsf_scale_list) {
std::vector<DisplayMode> display_mode_list;
- for (float ui_scale : scales) {
+ for (auto& pair : dsf_scale_list) {
DisplayMode mode = native_mode;
+ mode.device_scale_factor = pair.first;
gfx::SizeF scaled_size(native_mode.size);
- scaled_size.Scale(ui_scale);
+ scaled_size.Scale(pair.second);
mode.size = gfx::ToFlooredSize(scaled_size);
- mode.native = mode.size == native_mode.size;
+ mode.native = false;
display_mode_list.push_back(mode);
}
+ // Sort the mode by the size in DIP.
+ std::sort(display_mode_list.begin(), display_mode_list.end(),
+ [](const DisplayMode& a, const DisplayMode& b) {
+ return a.GetSizeInDIP(false).GetArea() <
+ b.GetSizeInDIP(false).GetArea();
+ });
return display_mode_list;
}
@@ -181,10 +188,12 @@ bool GetDisplayModeForNextResolution(const DisplayInfo& info,
if (gfx::Display::IsInternalDisplayId(info.id()))
return false;
const std::vector<DisplayMode>& modes = info.display_modes();
- const gfx::Size& resolution = info.size_in_pixel();
+ DisplayMode tmp(info.size_in_pixel(), 0.0f, false, false);
+ tmp.device_scale_factor = info.device_scale_factor();
+ gfx::Size resolution = tmp.GetSizeInDIP(false);
auto iter = std::find_if(modes.begin(), modes.end(),
[resolution](const DisplayMode& mode) {
- return mode.size == resolution;
+ return mode.GetSizeInDIP(false) == resolution;
});
FindNextMode(iter, modes, up, out);
return true;
« no previous file with comments | « ash/display/display_util.h ('k') | ash/display/root_window_transformers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698