OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/base/layout.h" | 5 #include "ui/base/layout.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <limits> | 9 #include <limits> |
10 | 10 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 smallest_diff = diff; | 78 smallest_diff = diff; |
79 } | 79 } |
80 } | 80 } |
81 DCHECK_NE(closest_match, SCALE_FACTOR_NONE); | 81 DCHECK_NE(closest_match, SCALE_FACTOR_NONE); |
82 return closest_match; | 82 return closest_match; |
83 } | 83 } |
84 | 84 |
85 float GetImageScale(ScaleFactor scale_factor) { | 85 float GetImageScale(ScaleFactor scale_factor) { |
86 #if defined(OS_WIN) | 86 #if defined(OS_WIN) |
87 if (gfx::IsHighDPIEnabled()) | 87 if (gfx::IsHighDPIEnabled()) |
88 return gfx::win::GetDeviceScaleFactor(); | 88 return gfx::GetDPIScale(); |
89 #endif | 89 #endif |
90 return GetScaleForScaleFactor(scale_factor); | 90 return GetScaleForScaleFactor(scale_factor); |
91 } | 91 } |
92 | 92 |
93 float GetScaleForScaleFactor(ScaleFactor scale_factor) { | 93 float GetScaleForScaleFactor(ScaleFactor scale_factor) { |
94 return kScaleFactorScales[scale_factor]; | 94 return kScaleFactorScales[scale_factor]; |
95 } | 95 } |
96 | 96 |
97 namespace test { | 97 namespace test { |
98 | 98 |
(...skipping 22 matching lines...) Expand all Loading... |
121 | 121 |
122 #if !defined(OS_MACOSX) | 122 #if !defined(OS_MACOSX) |
123 float GetScaleFactorForNativeView(gfx::NativeView view) { | 123 float GetScaleFactorForNativeView(gfx::NativeView view) { |
124 gfx::Screen* screen = gfx::Screen::GetScreenFor(view); | 124 gfx::Screen* screen = gfx::Screen::GetScreenFor(view); |
125 gfx::Display display = screen->GetDisplayNearestWindow(view); | 125 gfx::Display display = screen->GetDisplayNearestWindow(view); |
126 return display.device_scale_factor(); | 126 return display.device_scale_factor(); |
127 } | 127 } |
128 #endif // !defined(OS_MACOSX) | 128 #endif // !defined(OS_MACOSX) |
129 | 129 |
130 } // namespace ui | 130 } // namespace ui |
OLD | NEW |