diff options
author | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-12 17:20:42 +0000 |
---|---|---|
committer | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-12 17:20:42 +0000 |
commit | 85bc89195efe24944736a66ef49edc81e8319b1f (patch) | |
tree | 096b974a36835a668b2960ac4f542528e139ba66 /ui/base/dragdrop/drag_utils_win.cc | |
parent | 7ab8b9be98d03317adeae4302820e657721e5280 (diff) | |
download | chromium_src-85bc89195efe24944736a66ef49edc81e8319b1f.zip chromium_src-85bc89195efe24944736a66ef49edc81e8319b1f.tar.gz chromium_src-85bc89195efe24944736a66ef49edc81e8319b1f.tar.bz2 |
Ensure that size passed into drag_utils_win.cc's SetDragImageOnDataObject function is in pixels and is obtained from the SkBitmap instance.
This is needed for the drag image to show up without being clipped.
Removed the size parameter from the drag_utils::SetDragImageOnDataObject functions as it is not needed. We can get the size from the ImageSkia object as needed.
BUG=381611
R=sky
Review URL: https://codereview.chromium.org/328993002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@276725 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/base/dragdrop/drag_utils_win.cc')
-rw-r--r-- | ui/base/dragdrop/drag_utils_win.cc | 13 |
1 files changed, 8 insertions, 5 deletions
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)); } |