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

Side by Side Diff: ui/base/layout.cc

Issue 674763002: remove ui::gfx::GetDeviceScaleFactor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@dpi-cleanup-3
Patch Set: rebase-4 Created 6 years, 2 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
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/minimize_button_metrics_win.cc ('k') | ui/gfx/canvas_paint_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698