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

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

Issue 16336027: Enable high dpi in win/views. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase Created 7 years, 6 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/base/win/dpi.h ('k') | ui/base/win/events_win.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 (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/win/dpi.h" 5 #include "ui/base/win/dpi.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/win/scoped_hdc.h" 9 #include "base/win/scoped_hdc.h"
10 #include "ui/base/layout.h" 10 #include "ui/base/layout.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 float GetDeviceScaleFactor() { 97 float GetDeviceScaleFactor() {
98 static const float device_scale_factor = GetDeviceScaleFactorImpl(); 98 static const float device_scale_factor = GetDeviceScaleFactorImpl();
99 return device_scale_factor; 99 return device_scale_factor;
100 } 100 }
101 101
102 gfx::Point ScreenToDIPPoint(const gfx::Point& pixel_point) { 102 gfx::Point ScreenToDIPPoint(const gfx::Point& pixel_point) {
103 return gfx::ToFlooredPoint( 103 return gfx::ToFlooredPoint(
104 gfx::ScalePoint(pixel_point, 1.0f / GetDeviceScaleFactor())); 104 gfx::ScalePoint(pixel_point, 1.0f / GetDeviceScaleFactor()));
105 } 105 }
106 106
107 gfx::Point DIPToScreenPoint(const gfx::Point& dip_point) {
108 return gfx::ToFlooredPoint(
109 gfx::ScalePoint(dip_point, GetDeviceScaleFactor()));
110 }
111
107 gfx::Rect ScreenToDIPRect(const gfx::Rect& pixel_bounds) { 112 gfx::Rect ScreenToDIPRect(const gfx::Rect& pixel_bounds) {
108 // TODO(kevers): Switch to non-deprecated method for float to int conversions. 113 // TODO(kevers): Switch to non-deprecated method for float to int conversions.
109 return gfx::ToFlooredRectDeprecated( 114 return gfx::ToFlooredRectDeprecated(
110 gfx::ScaleRect(pixel_bounds, 1.0f / GetDeviceScaleFactor())); 115 gfx::ScaleRect(pixel_bounds, 1.0f / GetDeviceScaleFactor()));
111 } 116 }
112 117
113 gfx::Rect DIPToScreenRect(const gfx::Rect& dip_bounds) { 118 gfx::Rect DIPToScreenRect(const gfx::Rect& dip_bounds) {
114 // TODO(kevers): Switch to non-deprecated method for float to int conversions. 119 // TODO(kevers): Switch to non-deprecated method for float to int conversions.
115 return gfx::ToFlooredRectDeprecated( 120 return gfx::ToFlooredRectDeprecated(
116 gfx::ScaleRect(dip_bounds, GetDeviceScaleFactor())); 121 gfx::ScaleRect(dip_bounds, GetDeviceScaleFactor()));
(...skipping 29 matching lines...) Expand all
146 } 151 }
147 } 152 }
148 } 153 }
149 } 154 }
150 return scale; 155 return scale;
151 } 156 }
152 157
153 } // namespace win 158 } // namespace win
154 159
155 } // namespace ui 160 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/win/dpi.h ('k') | ui/base/win/events_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698