Index: ash/display/display_change_observer_chromeos.cc |
diff --git a/ash/display/display_change_observer_chromeos.cc b/ash/display/display_change_observer_chromeos.cc |
index cfc23017e3d9124f96d97cd41b50ccacf8fd6828..e85f8f0bfc7c8e72f850a43ff8791f99c3645ea2 100644 |
--- a/ash/display/display_change_observer_chromeos.cc |
+++ b/ash/display/display_change_observer_chromeos.cc |
@@ -32,7 +32,15 @@ namespace { |
// The DPI threshold to detect high density screen. |
// Higher DPI than this will use device_scale_factor=2. |
-const unsigned int kHighDensityDPIThreshold = 170; |
+const unsigned int kHighDensityDPIThresholdSmall = 170; |
+ |
+// The HiDPI threshold for large (usually external) monitors. Lower threshold |
+// makes sense for large monitors, because such monitors should be located |
+// farther from the user's face usually. See http://crbug.com/348279 |
+const unsigned int kHighDensityDPIThresholdLarge = 150; |
+ |
+// The width threshold in mm for "large" monitors. |
+const int kLargeDisplayWidthThresholdMM = 500; |
// 1 inch in mm. |
const float kInchInMm = 25.4f; |
@@ -88,6 +96,21 @@ std::vector<DisplayMode> DisplayChangeObserver::GetDisplayModeList( |
return display_mode_list; |
} |
+// static |
+float DisplayChangeObserver::GetScaleFactor( |
oshima
2014/04/09 23:07:37
can you move this (plus constants) to ui/display/d
Jun Mukai
2014/04/09 23:16:00
Done.
|
+ const gfx::Size& physical_size, |
+ const gfx::Size& screen_size) { |
+ if (ui::IsDisplaySizeBlackListed(physical_size)) |
+ return 1.0f; |
+ |
+ const unsigned int dpi = (kInchInMm * screen_size.width() / |
+ physical_size.width()); |
+ const unsigned int threshold = |
+ (physical_size.width() >= kLargeDisplayWidthThresholdMM) ? |
+ kHighDensityDPIThresholdLarge : kHighDensityDPIThresholdSmall; |
+ return (dpi > threshold) ? 2.0f : 1.0f; |
+} |
+ |
DisplayChangeObserver::DisplayChangeObserver() { |
Shell::GetInstance()->AddShellObserver(this); |
} |
@@ -133,12 +156,8 @@ void DisplayChangeObserver::OnDisplayModeChanged( |
if (!mode_info) |
continue; |
- float device_scale_factor = 1.0f; |
- if (!ui::IsDisplaySizeBlackListed(state.display->physical_size()) && |
- (kInchInMm * mode_info->size().width() / |
- state.display->physical_size().width()) > kHighDensityDPIThreshold) { |
- device_scale_factor = 2.0f; |
- } |
+ float device_scale_factor = GetScaleFactor( |
+ state.display->physical_size(), mode_info->size()); |
gfx::Rect display_bounds(state.display->origin(), mode_info->size()); |
std::vector<DisplayMode> display_modes = GetDisplayModeList(state); |