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

Side by Side Diff: ash/display/display_change_observer_chromeos.cc

Issue 562413002: Adds (native) annotation to the display settings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 6 years, 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | ash/display/display_change_observer_chromeos_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 "ash/display/display_change_observer_chromeos.h" 5 #include "ash/display/display_change_observer_chromeos.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 DisplayMode native_mode(ui_native_mode->size(), 77 DisplayMode native_mode(ui_native_mode->size(),
78 ui_native_mode->refresh_rate(), 78 ui_native_mode->refresh_rate(),
79 ui_native_mode->is_interlaced(), 79 ui_native_mode->is_interlaced(),
80 true); 80 true);
81 native_mode.device_scale_factor = display_info.device_scale_factor(); 81 native_mode.device_scale_factor = display_info.device_scale_factor();
82 std::vector<float> ui_scales = 82 std::vector<float> ui_scales =
83 DisplayManager::GetScalesForDisplay(display_info); 83 DisplayManager::GetScalesForDisplay(display_info);
84 for (size_t i = 0; i < ui_scales.size(); ++i) { 84 for (size_t i = 0; i < ui_scales.size(); ++i) {
85 DisplayMode mode = native_mode; 85 DisplayMode mode = native_mode;
86 mode.ui_scale = ui_scales[i]; 86 mode.ui_scale = ui_scales[i];
87 mode.native = (ui_scales[i] == 1.0f); 87 mode.native = (ui_scales[i] == display_info.device_scale_factor());
88 display_mode_list.push_back(mode); 88 display_mode_list.push_back(mode);
89 } 89 }
90 90
91 std::sort( 91 std::sort(
92 display_mode_list.begin(), display_mode_list.end(), DisplayModeSorter()); 92 display_mode_list.begin(), display_mode_list.end(), DisplayModeSorter());
93 return display_mode_list; 93 return display_mode_list;
94 } 94 }
95 95
96 // static 96 // static
97 std::vector<DisplayMode> DisplayChangeObserver::GetExternalDisplayModeList( 97 std::vector<DisplayMode> DisplayChangeObserver::GetExternalDisplayModeList(
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 // static 256 // static
257 float DisplayChangeObserver::FindDeviceScaleFactor(float dpi) { 257 float DisplayChangeObserver::FindDeviceScaleFactor(float dpi) {
258 for (size_t i = 0; i < arraysize(kThresholdTable); ++i) { 258 for (size_t i = 0; i < arraysize(kThresholdTable); ++i) {
259 if (dpi > kThresholdTable[i].dpi) 259 if (dpi > kThresholdTable[i].dpi)
260 return kThresholdTable[i].device_scale_factor; 260 return kThresholdTable[i].device_scale_factor;
261 } 261 }
262 return 1.0f; 262 return 1.0f;
263 } 263 }
264 264
265 } // namespace ash 265 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/display/display_change_observer_chromeos_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698