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

Unified Diff: ui/gfx/win/dpi.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gfx/win/dpi.h ('k') | ui/views/controls/menu/menu_separator_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/win/dpi.cc
diff --git a/ui/gfx/win/dpi.cc b/ui/gfx/win/dpi.cc
index 86cd15c39d6cb5f5aa4f0d18b864c49c9ea88549..a9352a817acfaf05221f9d0d4e96cf690657e4aa 100644
--- a/ui/gfx/win/dpi.cc
+++ b/ui/gfx/win/dpi.cc
@@ -34,9 +34,7 @@ float g_device_scale_factor = 0.0f;
float GetUnforcedDeviceScaleFactor() {
// If the global device scale factor is initialized use it. This is to ensure
- // we use the same scale factor across all callsites. We don't use the
- // GetDeviceScaleFactor function here because it fires a DCHECK if the
- // g_device_scale_factor global is 0.
+ // we use the same scale factor across all callsites.
if (g_device_scale_factor)
return g_device_scale_factor;
return static_cast<float>(gfx::GetDPI().width()) /
@@ -172,18 +170,12 @@ GFX_EXPORT const wchar_t kRegistryProfilePath[] =
L"Software\\Google\\Chrome\\Profile";
GFX_EXPORT const wchar_t kHighDPISupportW[] = L"high-dpi-support";
-float GetDeviceScaleFactor() {
- DCHECK_NE(0.0f, g_device_scale_factor);
- return g_device_scale_factor;
-}
-
Point ScreenToDIPPoint(const Point& pixel_point) {
- return ToFlooredPoint(ScalePoint(pixel_point,
- 1.0f / GetDeviceScaleFactor()));
+ return ToFlooredPoint(ScalePoint(pixel_point, 1.0f / GetDPIScale()));
}
Point DIPToScreenPoint(const Point& dip_point) {
- return ToFlooredPoint(ScalePoint(dip_point, GetDeviceScaleFactor()));
+ return ToFlooredPoint(ScalePoint(dip_point, GetDPIScale()));
}
Rect ScreenToDIPRect(const Rect& pixel_bounds) {
@@ -204,18 +196,16 @@ Rect DIPToScreenRect(const Rect& dip_bounds) {
Size ScreenToDIPSize(const Size& size_in_pixels) {
// Always ceil sizes. Otherwise we may be leaving off part of the bounds.
- return ToCeiledSize(
- ScaleSize(size_in_pixels, 1.0f / GetDeviceScaleFactor()));
+ return ToCeiledSize(ScaleSize(size_in_pixels, 1.0f / GetDPIScale()));
}
Size DIPToScreenSize(const Size& dip_size) {
// Always ceil sizes. Otherwise we may be leaving off part of the bounds.
- return ToCeiledSize(ScaleSize(dip_size, GetDeviceScaleFactor()));
+ return ToCeiledSize(ScaleSize(dip_size, GetDPIScale()));
}
int GetSystemMetricsInDIP(int metric) {
- return static_cast<int>(GetSystemMetrics(metric) /
- GetDeviceScaleFactor() + 0.5);
+ return static_cast<int>(GetSystemMetrics(metric) / GetDPIScale() + 0.5);
}
bool IsDeviceScaleFactorSet() {
« no previous file with comments | « ui/gfx/win/dpi.h ('k') | ui/views/controls/menu/menu_separator_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698