Index: ui/base/win/dpi_setup.cc |
diff --git a/ui/base/win/dpi_setup.cc b/ui/base/win/dpi_setup.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..b80b8126d068e3ac16371429d16caf360f3dcc6a |
--- /dev/null |
+++ b/ui/base/win/dpi_setup.cc |
@@ -0,0 +1,26 @@ |
+// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "ui/base/win/dpi_setup.h" |
+ |
+#include "ui/base/layout.h" |
+#include "ui/gfx/display.h" |
+#include "ui/gfx/win/dpi.h" |
+ |
+namespace ui { |
+namespace win { |
+ |
+void InitDeviceScaleFactor() { |
+ float scale = 1.0f; |
+ if (gfx::IsHighDPIEnabled()) { |
+ float scale = gfx::Display::HasForceDeviceScaleFactor() ? |
+ gfx::Display::GetForcedDeviceScaleFactor() : gfx::GetDPIScale(); |
+ // Quantize to nearest supported scale factor. |
+ scale = ui::GetImageScale(ui::GetSupportedScaleFactor(scale)); |
+ } |
+ gfx::InitDeviceScaleFactor(scale); |
+} |
+ |
+} // namespace win |
+} // namespace ui |