OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/util/display_util.h" | 5 #include "ui/display/util/display_util.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 | 8 |
9 namespace ui { | 9 namespace ui { |
10 | 10 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 } | 53 } |
54 } | 54 } |
55 return false; | 55 return false; |
56 } | 56 } |
57 | 57 |
58 float GetScaleFactor(const gfx::Size& physical_size_in_mm, | 58 float GetScaleFactor(const gfx::Size& physical_size_in_mm, |
59 const gfx::Size& screen_size_in_pixels) { | 59 const gfx::Size& screen_size_in_pixels) { |
60 if (IsDisplaySizeBlackListed(physical_size_in_mm)) | 60 if (IsDisplaySizeBlackListed(physical_size_in_mm)) |
61 return 1.0f; | 61 return 1.0f; |
62 | 62 |
63 const unsigned int dpi = (kInchInMm * screen_size_in_pixels.width() / | 63 const unsigned int dpi = static_cast<unsigned int>( |
64 physical_size_in_mm.width()); | 64 kInchInMm * screen_size_in_pixels.width() / physical_size_in_mm.width()); |
65 const unsigned int threshold = | 65 const unsigned int threshold = |
66 (physical_size_in_mm.width() >= kLargeDisplayWidthThresholdMM) ? | 66 (physical_size_in_mm.width() >= kLargeDisplayWidthThresholdMM) ? |
67 kHighDensityDPIThresholdLarge : kHighDensityDPIThresholdSmall; | 67 kHighDensityDPIThresholdLarge : kHighDensityDPIThresholdSmall; |
68 return (dpi > threshold) ? 2.0f : 1.0f; | 68 return (dpi > threshold) ? 2.0f : 1.0f; |
69 } | 69 } |
70 | 70 |
71 } // namespace ui | 71 } // namespace ui |
OLD | NEW |