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 862b22867097cfa2a44c1927f89caebf8e94c21a..02578e8444c05fd90c8562d73f4a7efa9f484e15 100644 |
--- a/ash/display/display_change_observer_chromeos.cc |
+++ b/ash/display/display_change_observer_chromeos.cc |
@@ -34,6 +34,14 @@ namespace { |
// Higher DPI than this will use device_scale_factor=2. |
const unsigned int kHighDensityDPIThreshold = 170; |
+// The HiDPI threshold for bigger (usually external) monitors. Lower threshold |
oshima
2014/04/08 20:39:47
"Large" is probably better term. Can you update th
Jun Mukai
2014/04/09 20:20:07
Done.
|
+// makes sense for bigger monitors, because such monitors should be located |
+// farther from the user's face usually. See http://crbug.com/348279 |
+const unsigned int kHighDensityDPIThresholdBigger = 150; |
+ |
+// The width threshold in mm for "bigger" monitors. |
+const int kBiggerDisplayWidthThresholdMM = 500; |
+ |
// 1 inch in mm. |
const float kInchInMm = 25.4f; |
@@ -48,6 +56,19 @@ struct DisplayModeSorter { |
} |
}; |
+bool ShouldBeHiDPI(const gfx::Size& physical_size, |
oshima
2014/04/08 20:39:47
Can you change this to return scale factor (like G
Jun Mukai
2014/04/09 20:20:07
Done.
|
+ const ui::DisplayMode& mode_info) { |
+ if (ui::IsDisplaySizeBlackListed(physical_size)) |
+ return false; |
+ |
+ const unsigned int dpi = (kInchInMm * mode_info.size().width() / |
+ physical_size.width()); |
+ const unsigned int threshold = |
+ (physical_size.width() >= kBiggerDisplayWidthThresholdMM) ? |
+ kHighDensityDPIThresholdBigger : kHighDensityDPIThreshold; |
+ return dpi > threshold; |
+} |
+ |
} // namespace |
// static |
@@ -134,11 +155,9 @@ void DisplayChangeObserver::OnDisplayModeChanged( |
continue; |
float device_scale_factor = 1.0f; |
- if (!ui::IsDisplaySizeBlackListed(output.display->physical_size()) && |
- (kInchInMm * mode_info->size().width() / |
- output.display->physical_size().width()) > kHighDensityDPIThreshold) { |
+ if (ShouldBeHiDPI(output.display->physical_size(), *mode_info)) |
device_scale_factor = 2.0f; |
- } |
+ |
gfx::Rect display_bounds(output.display->origin(), mode_info->size()); |
std::vector<DisplayMode> display_modes = GetDisplayModeList(output); |