| 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 "ui/display/manager/chromeos/display_change_observer.h" | 5 #include "ui/display/manager/chromeos/display_change_observer.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 namespace display { | 30 namespace display { |
| 31 namespace { | 31 namespace { |
| 32 | 32 |
| 33 // The DPI threshold to determine the device scale factor. | 33 // The DPI threshold to determine the device scale factor. |
| 34 // DPI higher than |dpi| will use |device_scale_factor|. | 34 // DPI higher than |dpi| will use |device_scale_factor|. |
| 35 struct DeviceScaleFactorDPIThreshold { | 35 struct DeviceScaleFactorDPIThreshold { |
| 36 float dpi; | 36 float dpi; |
| 37 float device_scale_factor; | 37 float device_scale_factor; |
| 38 }; | 38 }; |
| 39 | 39 |
| 40 const DeviceScaleFactorDPIThreshold kThresholdTable[] = { | 40 const DeviceScaleFactorDPIThreshold kThresholdTableForInternal[] = { |
| 41 {220.0f, 2.0f}, | 41 {220.0f, 2.0f}, |
| 42 {180.0f, 1.5f}, | 42 {200.0f, 1.6f}, |
| 43 {150.0f, 1.25f}, | 43 {150.0f, 1.25f}, |
| 44 {0.0f, 1.0f}, | 44 {0.0f, 1.0f}, |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 // 1 inch in mm. | 47 // 1 inch in mm. |
| 48 const float kInchInMm = 25.4f; | 48 const float kInchInMm = 25.4f; |
| 49 | 49 |
| 50 // The minimum pixel width whose monitor can be called as '4K'. | 50 // The minimum pixel width whose monitor can be called as '4K'. |
| 51 const int kMinimumWidthFor4K = 3840; | 51 const int kMinimumWidthFor4K = 3840; |
| 52 | 52 |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 // there aren't any touchscreens to associate. For the second case, the | 283 // there aren't any touchscreens to associate. For the second case, the |
| 284 // displays and touch input-devices will get associated when display | 284 // displays and touch input-devices will get associated when display |
| 285 // configuration finishes. | 285 // configuration finishes. |
| 286 const auto& cached_displays = display_configurator_->cached_displays(); | 286 const auto& cached_displays = display_configurator_->cached_displays(); |
| 287 if (!cached_displays.empty()) | 287 if (!cached_displays.empty()) |
| 288 OnDisplayModeChanged(cached_displays); | 288 OnDisplayModeChanged(cached_displays); |
| 289 } | 289 } |
| 290 | 290 |
| 291 // static | 291 // static |
| 292 float DisplayChangeObserver::FindDeviceScaleFactor(float dpi) { | 292 float DisplayChangeObserver::FindDeviceScaleFactor(float dpi) { |
| 293 for (size_t i = 0; i < arraysize(kThresholdTable); ++i) { | 293 for (size_t i = 0; i < arraysize(kThresholdTableForInternal); ++i) { |
| 294 if (dpi > kThresholdTable[i].dpi) | 294 if (dpi > kThresholdTableForInternal[i].dpi) |
| 295 return kThresholdTable[i].device_scale_factor; | 295 return kThresholdTableForInternal[i].device_scale_factor; |
| 296 } | 296 } |
| 297 return 1.0f; | 297 return 1.0f; |
| 298 } | 298 } |
| 299 | 299 |
| 300 } // namespace display | 300 } // namespace display |
| OLD | NEW |