Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 if (display_info.device_scale_factor() == 2.0f) { |
| 88 mode.native = (ui_scales[i] == 2.0f); | |
| 89 } else { | |
| 90 mode.native = (ui_scales[i] == 1.0f); | |
| 91 } | |
|
oshima
2014/09/12 17:23:49
this should be
mode.native = (ui_scales[i] == dev
Jun Mukai
2014/09/12 18:50:55
right, done. also added the test case of dsf == 1
| |
| 88 display_mode_list.push_back(mode); | 92 display_mode_list.push_back(mode); |
| 89 } | 93 } |
| 90 | 94 |
| 91 std::sort( | 95 std::sort( |
| 92 display_mode_list.begin(), display_mode_list.end(), DisplayModeSorter()); | 96 display_mode_list.begin(), display_mode_list.end(), DisplayModeSorter()); |
| 93 return display_mode_list; | 97 return display_mode_list; |
| 94 } | 98 } |
| 95 | 99 |
| 96 // static | 100 // static |
| 97 std::vector<DisplayMode> DisplayChangeObserver::GetExternalDisplayModeList( | 101 std::vector<DisplayMode> DisplayChangeObserver::GetExternalDisplayModeList( |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 256 // static | 260 // static |
| 257 float DisplayChangeObserver::FindDeviceScaleFactor(float dpi) { | 261 float DisplayChangeObserver::FindDeviceScaleFactor(float dpi) { |
| 258 for (size_t i = 0; i < arraysize(kThresholdTable); ++i) { | 262 for (size_t i = 0; i < arraysize(kThresholdTable); ++i) { |
| 259 if (dpi > kThresholdTable[i].dpi) | 263 if (dpi > kThresholdTable[i].dpi) |
| 260 return kThresholdTable[i].device_scale_factor; | 264 return kThresholdTable[i].device_scale_factor; |
| 261 } | 265 } |
| 262 return 1.0f; | 266 return 1.0f; |
| 263 } | 267 } |
| 264 | 268 |
| 265 } // namespace ash | 269 } // namespace ash |
| OLD | NEW |