summaryrefslogtreecommitdiffstats
path: root/ui/base/dragdrop
diff options
context:
space:
mode:
Diffstat (limited to 'ui/base/dragdrop')
-rw-r--r--ui/base/dragdrop/drag_utils.cc5
-rw-r--r--ui/base/dragdrop/drag_utils.h12
-rw-r--r--ui/base/dragdrop/drag_utils_aura.cc1
-rw-r--r--ui/base/dragdrop/drag_utils_mac.mm2
-rw-r--r--ui/base/dragdrop/drag_utils_win.cc13
5 files changed, 14 insertions, 19 deletions
diff --git a/ui/base/dragdrop/drag_utils.cc b/ui/base/dragdrop/drag_utils.cc
index 7be094f..b9faf3f 100644
--- a/ui/base/dragdrop/drag_utils.cc
+++ b/ui/base/dragdrop/drag_utils.cc
@@ -92,15 +92,14 @@ void CreateDragImageForFile(const base::FilePath& file_name,
gfx::ImageSkia image = gfx::ImageSkia(source, size);
gfx::Vector2d cursor_offset(size.width() / 2, kLinkDragImageVPadding);
- SetDragImageOnDataObject(image, size, cursor_offset, data_object);
+ SetDragImageOnDataObject(image, cursor_offset, data_object);
}
void SetDragImageOnDataObject(const gfx::Canvas& canvas,
- const gfx::Size& size,
const gfx::Vector2d& cursor_offset,
ui::OSExchangeData* data_object) {
gfx::ImageSkia image = gfx::ImageSkia(canvas.ExtractImageRep());
- SetDragImageOnDataObject(image, size, cursor_offset, data_object);
+ SetDragImageOnDataObject(image, cursor_offset, data_object);
}
} // namespace drag_utils
diff --git a/ui/base/dragdrop/drag_utils.h b/ui/base/dragdrop/drag_utils.h
index f035561..48ee94f 100644
--- a/ui/base/dragdrop/drag_utils.h
+++ b/ui/base/dragdrop/drag_utils.h
@@ -34,19 +34,15 @@ UI_BASE_EXPORT void CreateDragImageForFile(const base::FilePath& file_name,
const gfx::ImageSkia& icon,
ui::OSExchangeData* data_object);
-// Sets the drag image on data_object from the supplied canvas. width/height
-// are the size of the image to use, and the offsets give the location of
-// the hotspot for the drag image.
+// Sets the drag image on data_object from the supplied canvas.
+// |cursor_offset| gives the location of the hotspot for the drag image.
UI_BASE_EXPORT void SetDragImageOnDataObject(const gfx::Canvas& canvas,
- const gfx::Size& size,
const gfx::Vector2d& cursor_offset,
ui::OSExchangeData* data_object);
-// Sets the drag image on data_object from the supplied ImageSkia. width/height
-// are the size of the image to use, and the offsets give the location of
-// the hotspot for the drag image.
+// Sets the drag image on data_object from the supplied ImageSkia.
+// |cursor_offset| gives the location of the hotspot for the drag image.
UI_BASE_EXPORT void SetDragImageOnDataObject(const gfx::ImageSkia& image_skia,
- const gfx::Size& size,
const gfx::Vector2d& cursor_offset,
ui::OSExchangeData* data_object);
diff --git a/ui/base/dragdrop/drag_utils_aura.cc b/ui/base/dragdrop/drag_utils_aura.cc
index 23c84fc..e202e81 100644
--- a/ui/base/dragdrop/drag_utils_aura.cc
+++ b/ui/base/dragdrop/drag_utils_aura.cc
@@ -14,7 +14,6 @@
namespace drag_utils {
void SetDragImageOnDataObject(const gfx::ImageSkia& image,
- const gfx::Size& size,
const gfx::Vector2d& cursor_offset,
ui::OSExchangeData* data_object) {
diff --git a/ui/base/dragdrop/drag_utils_mac.mm b/ui/base/dragdrop/drag_utils_mac.mm
index 44793f7..22171bd 100644
--- a/ui/base/dragdrop/drag_utils_mac.mm
+++ b/ui/base/dragdrop/drag_utils_mac.mm
@@ -9,14 +9,12 @@
namespace drag_utils {
void SetDragImageOnDataObject(const gfx::Canvas& canvas,
- const gfx::Size& size,
const gfx::Vector2d& cursor_offset,
ui::OSExchangeData* data_object) {
NOTIMPLEMENTED();
}
void SetDragImageOnDataObject(const gfx::ImageSkia& image_skia,
- const gfx::Size& size,
const gfx::Vector2d& cursor_offset,
ui::OSExchangeData* data_object) {
NOTIMPLEMENTED();
diff --git a/ui/base/dragdrop/drag_utils_win.cc b/ui/base/dragdrop/drag_utils_win.cc
index ebb4c7e..9fedd42 100644
--- a/ui/base/dragdrop/drag_utils_win.cc
+++ b/ui/base/dragdrop/drag_utils_win.cc
@@ -15,13 +15,14 @@
#include "ui/base/dragdrop/os_exchange_data_provider_win.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/gdi_util.h"
+#include "ui/gfx/geometry/size.h"
#include "ui/gfx/image/image_skia.h"
#include "ui/gfx/skbitmap_operations.h"
namespace drag_utils {
static void SetDragImageOnDataObject(HBITMAP hbitmap,
- const gfx::Size& size,
+ const gfx::Size& size_in_pixels,
const gfx::Vector2d& cursor_offset,
IDataObject* data_object) {
base::win::ScopedComPtr<IDragSourceHelper> helper;
@@ -29,7 +30,7 @@ static void SetDragImageOnDataObject(HBITMAP hbitmap,
IID_IDragSourceHelper, helper.ReceiveVoid());
if (SUCCEEDED(rv)) {
SHDRAGIMAGE sdi;
- sdi.sizeDragImage = size.ToSIZE();
+ sdi.sizeDragImage = size_in_pixels.ToSIZE();
sdi.crColorKey = 0xFFFFFFFF;
sdi.hbmpDragImage = hbitmap;
sdi.ptOffset = gfx::PointAtOffsetFromOrigin(cursor_offset).ToPOINT();
@@ -57,10 +58,9 @@ static HBITMAP CreateHBITMAPFromSkBitmap(const SkBitmap& sk_bitmap) {
}
void SetDragImageOnDataObject(const gfx::ImageSkia& image_skia,
- const gfx::Size& size,
const gfx::Vector2d& cursor_offset,
ui::OSExchangeData* data_object) {
- DCHECK(data_object && !size.IsEmpty());
+ DCHECK(data_object && !image_skia.size().IsEmpty());
// InitializeFromBitmap() doesn't expect an alpha channel and is confused
// by premultiplied colors, so unpremultiply the bitmap.
// SetDragImageOnDataObject(HBITMAP) takes ownership of the bitmap.
@@ -68,7 +68,10 @@ void SetDragImageOnDataObject(const gfx::ImageSkia& image_skia,
SkBitmapOperations::UnPreMultiply(*image_skia.bitmap()));
if (bitmap) {
// Attach 'bitmap' to the data_object.
- SetDragImageOnDataObject(bitmap, size, cursor_offset,
+ SetDragImageOnDataObject(
+ bitmap,
+ gfx::Size(image_skia.bitmap()->width(), image_skia.bitmap()->height()),
+ cursor_offset,
ui::OSExchangeDataProviderWin::GetIDataObject(*data_object));
}