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

Unified Diff: trunk/src/ui/views/drag_utils.cc

Issue 24262008: Revert 224473 "Remove dependency on ui::ScaleFactor from ui/gfx" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 3 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 | « trunk/src/ui/views/controls/menu/native_menu_win.cc ('k') | trunk/src/ui/views/win/hwnd_message_handler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: trunk/src/ui/views/drag_utils.cc
===================================================================
--- trunk/src/ui/views/drag_utils.cc (revision 224498)
+++ trunk/src/ui/views/drag_utils.cc (working copy)
@@ -22,8 +22,8 @@
#error
#endif
-float GetDeviceScaleForNativeView(views::Widget* widget) {
- float device_scale = 1.0f;
+ui::ScaleFactor GetDeviceScaleFactorForNativeView(views::Widget* widget) {
+ ui::ScaleFactor device_scale_factor = ui::SCALE_FACTOR_100P;
#if defined(USE_AURA)
// The following code should work on other platforms as well. But we do not
// yet care about device scale factor on other platforms. So to keep drag and
@@ -32,10 +32,11 @@
gfx::NativeView view = widget->GetNativeView();
gfx::Display display = gfx::Screen::GetScreenFor(view)->
GetDisplayNearestWindow(view);
- device_scale = display.device_scale_factor();
+ device_scale_factor = ui::GetScaleFactorFromScale(
+ display.device_scale_factor());
}
#endif
- return device_scale;
+ return device_scale_factor;
}
namespace views {
@@ -65,8 +66,9 @@
gfx::Canvas* GetCanvasForDragImage(views::Widget* widget,
const gfx::Size& canvas_size) {
- float device_scale = GetDeviceScaleForNativeView(widget);
- return new gfx::Canvas(canvas_size, device_scale, false);
+ ui::ScaleFactor device_scale_factor =
+ GetDeviceScaleFactorForNativeView(widget);
+ return new gfx::Canvas(canvas_size, device_scale_factor, false);
}
} // namespace views
« no previous file with comments | « trunk/src/ui/views/controls/menu/native_menu_win.cc ('k') | trunk/src/ui/views/win/hwnd_message_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698