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

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

Issue 1161933007: ui: Introduce CanvasPainter, remove PaintContext(gfx::Canvas*). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: canvaspainter: . Created 5 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/views/DEPS ('k') | ui/views/cocoa/bridged_content_view.mm » ('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/views/button_drag_utils.h" 5 #include "ui/views/button_drag_utils.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "ui/base/dragdrop/drag_utils.h" 8 #include "ui/base/dragdrop/drag_utils.h"
9 #include "ui/base/dragdrop/os_exchange_data.h" 9 #include "ui/base/dragdrop/os_exchange_data.h"
10 #include "ui/base/resource/resource_bundle.h" 10 #include "ui/base/resource/resource_bundle.h"
11 #include "ui/compositor/paint_context.h" 11 #include "ui/compositor/canvas_painter.h"
12 #include "ui/gfx/canvas.h" 12 #include "ui/gfx/canvas.h"
13 #include "ui/gfx/geometry/point.h" 13 #include "ui/gfx/geometry/point.h"
14 #include "ui/gfx/geometry/vector2d.h" 14 #include "ui/gfx/geometry/vector2d.h"
15 #include "ui/gfx/image/image.h" 15 #include "ui/gfx/image/image.h"
16 #include "ui/resources/grit/ui_resources.h" 16 #include "ui/resources/grit/ui_resources.h"
17 #include "ui/views/controls/button/label_button.h" 17 #include "ui/views/controls/button/label_button.h"
18 #include "ui/views/drag_utils.h" 18 #include "ui/views/drag_utils.h"
19 #include "ui/views/widget/widget.h" 19 #include "ui/views/widget/widget.h"
20 #include "url/gurl.h" 20 #include "url/gurl.h"
21 21
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 69
70 gfx::Vector2d press_point; 70 gfx::Vector2d press_point;
71 if (press_pt) 71 if (press_pt)
72 press_point = press_pt->OffsetFromOrigin(); 72 press_point = press_pt->OffsetFromOrigin();
73 else 73 else
74 press_point = gfx::Vector2d(prefsize.width() / 2, prefsize.height() / 2); 74 press_point = gfx::Vector2d(prefsize.width() / 2, prefsize.height() / 2);
75 75
76 // Render the image. 76 // Render the image.
77 scoped_ptr<gfx::Canvas> canvas( 77 scoped_ptr<gfx::Canvas> canvas(
78 views::GetCanvasForDragImage(widget, prefsize)); 78 views::GetCanvasForDragImage(widget, prefsize));
79 button.Paint(ui::PaintContext(canvas.get())); 79 button.Paint(ui::CanvasPainter(canvas.get(), 1.f).context());
80 drag_utils::SetDragImageOnDataObject(*canvas, press_point, data); 80 drag_utils::SetDragImageOnDataObject(*canvas, press_point, data);
81 } 81 }
82 82
83 } // namespace button_drag_utils 83 } // namespace button_drag_utils
OLDNEW
« no previous file with comments | « ui/views/DEPS ('k') | ui/views/cocoa/bridged_content_view.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698