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

Side by Side Diff: ui/views/drag_utils.cc

Issue 2793133002: ui: Remove SkCanvas methods from drag utils. (Closed)
Patch Set: Created 3 years, 8 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/views/drag_utils.h" 5 #include "ui/views/drag_utils.h"
6 6
7 #include "ui/base/layout.h" 7 #include "ui/base/layout.h"
8 #include "ui/gfx/canvas.h"
9 #include "ui/gfx/geometry/size.h"
10 #include "ui/views/widget/widget.h" 8 #include "ui/views/widget/widget.h"
11 9
12 namespace views { 10 namespace views {
13 11
14 float ScaleFactorForDragFromWidget(const Widget* widget) { 12 float ScaleFactorForDragFromWidget(const Widget* widget) {
15 float device_scale = 1.0f; 13 float device_scale = 1.0f;
16 if (widget && widget->GetNativeView()) { 14 if (widget && widget->GetNativeView()) {
17 gfx::NativeView view = widget->GetNativeView(); 15 gfx::NativeView view = widget->GetNativeView();
18 device_scale = ui::GetScaleFactorForNativeView(view); 16 device_scale = ui::GetScaleFactorForNativeView(view);
19 } 17 }
20 return device_scale; 18 return device_scale;
21 } 19 }
22 20
23 gfx::Canvas* GetCanvasForDragImage(const Widget* widget,
24 const gfx::Size& canvas_size) {
25 float device_scale = ScaleFactorForDragFromWidget(widget);
26 return new gfx::Canvas(canvas_size, device_scale, false);
27 }
28
29 } // namespace views 21 } // namespace views
OLDNEW
« ui/views/controls/menu/menu_controller.cc ('K') | « ui/views/drag_utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698