summaryrefslogtreecommitdiffstats
path: root/views/drag_utils_win.cc
diff options
context:
space:
mode:
authorthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-25 07:12:22 +0000
committerthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-25 07:12:22 +0000
commit16f17f5edd89d6b6a41709a9946a0183f5754c35 (patch)
tree1f887f3366390790c28f7b6b92a77f64994e48e6 /views/drag_utils_win.cc
parentb9a4ea7fbdc54868b60d50bc5fade451718dec23 (diff)
downloadchromium_src-16f17f5edd89d6b6a41709a9946a0183f5754c35.zip
chromium_src-16f17f5edd89d6b6a41709a9946a0183f5754c35.tar.gz
chromium_src-16f17f5edd89d6b6a41709a9946a0183f5754c35.tar.bz2
Chrome/win: Show preview images when dragging images.
BUG=11457 TEST=Go to google.com, drag logo around. Should be attached to cursor. Review URL: http://codereview.chromium.org/2870026 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50830 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/drag_utils_win.cc')
-rw-r--r--views/drag_utils_win.cc11
1 files changed, 8 insertions, 3 deletions
diff --git a/views/drag_utils_win.cc b/views/drag_utils_win.cc
index 74663a6..84b4ba1 100644
--- a/views/drag_utils_win.cc
+++ b/views/drag_utils_win.cc
@@ -10,8 +10,9 @@
#include "app/os_exchange_data.h"
#include "app/os_exchange_data_provider_win.h"
-#include "gfx/canvas.h"
+#include "gfx/canvas_skia.h"
#include "gfx/gdi_util.h"
+#include "third_party/skia/include/core/SkBitmap.h"
namespace drag_utils {
@@ -34,7 +35,7 @@ static void SetDragImageOnDataObject(HBITMAP hbitmap,
// Blit the contents of the canvas to a new HBITMAP. It is the caller's
// responsibility to release the |bits| buffer.
-static HBITMAP CreateBitmapFromCanvas(const gfx::Canvas& canvas,
+static HBITMAP CreateBitmapFromCanvas(const gfx::CanvasSkia& canvas,
int width,
int height) {
HDC screen_dc = GetDC(NULL);
@@ -55,10 +56,14 @@ static HBITMAP CreateBitmapFromCanvas(const gfx::Canvas& canvas,
return bitmap;
}
-void SetDragImageOnDataObject(const gfx::Canvas& canvas,
+void SetDragImageOnDataObject(const SkBitmap& sk_bitmap,
const gfx::Size& size,
const gfx::Point& cursor_offset,
OSExchangeData* data_object) {
+ gfx::CanvasSkia canvas(sk_bitmap.width(), sk_bitmap.height(),
+ /*is_opaque=*/false);
+ canvas.DrawBitmapInt(sk_bitmap, 0, 0);
+
DCHECK(data_object && !size.IsEmpty());
// SetDragImageOnDataObject(HBITMAP) takes ownership of the bitmap.
HBITMAP bitmap = CreateBitmapFromCanvas(canvas, size.width(), size.height());