Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(38)

Side by Side Diff: ui/display/win/dpi.cc

Issue 1929873005: Rename gfx::Display/Screen to display::Display/Screen in ui/display, ui/ozon (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/display/manager/display_layout.cc ('k') | ui/display/win/screen_win_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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/display/win/dpi.h" 5 #include "ui/display/win/dpi.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 8
9 #include "base/win/scoped_hdc.h" 9 #include "base/win/scoped_hdc.h"
10 #include "ui/gfx/display.h" 10 #include "ui/display/display.h"
11 11
12 namespace display { 12 namespace display {
13 namespace win { 13 namespace win {
14 14
15 namespace { 15 namespace {
16 16
17 const float kDefaultDPI = 96.f; 17 const float kDefaultDPI = 96.f;
18 18
19 float g_device_scale_factor = 0.f; 19 float g_device_scale_factor = 0.f;
20 20
(...skipping 21 matching lines...) Expand all
42 } 42 }
43 43
44 } // namespace 44 } // namespace
45 45
46 void SetDefaultDeviceScaleFactor(float scale) { 46 void SetDefaultDeviceScaleFactor(float scale) {
47 DCHECK_NE(0.f, scale); 47 DCHECK_NE(0.f, scale);
48 g_device_scale_factor = scale; 48 g_device_scale_factor = scale;
49 } 49 }
50 50
51 float GetDPIScale() { 51 float GetDPIScale() {
52 if (gfx::Display::HasForceDeviceScaleFactor()) 52 if (display::Display::HasForceDeviceScaleFactor())
53 return gfx::Display::GetForcedDeviceScaleFactor(); 53 return display::Display::GetForcedDeviceScaleFactor();
54 float dpi_scale = GetUnforcedDeviceScaleFactor(); 54 float dpi_scale = GetUnforcedDeviceScaleFactor();
55 return (dpi_scale <= 1.25f) ? 1.f : dpi_scale; 55 return (dpi_scale <= 1.25f) ? 1.f : dpi_scale;
56 } 56 }
57 57
58 int GetDPIFromScalingFactor(float device_scaling_factor) { 58 int GetDPIFromScalingFactor(float device_scaling_factor) {
59 return kDefaultDPI * device_scaling_factor; 59 return kDefaultDPI * device_scaling_factor;
60 } 60 }
61 61
62 int GetSystemMetricsInDIP(int metric) { 62 int GetSystemMetricsInDIP(int metric) {
63 // The system metrics always reflect the system DPI, not whatever scale we've 63 // The system metrics always reflect the system DPI, not whatever scale we've
64 // forced or decided to use. 64 // forced or decided to use.
65 return static_cast<int>( 65 return static_cast<int>(
66 std::round(GetSystemMetrics(metric) / GetUnforcedDeviceScaleFactor())); 66 std::round(GetSystemMetrics(metric) / GetUnforcedDeviceScaleFactor()));
67 } 67 }
68 68
69 } // namespace win 69 } // namespace win
70 } // namespace display 70 } // namespace display
OLDNEW
« no previous file with comments | « ui/display/manager/display_layout.cc ('k') | ui/display/win/screen_win_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698