Chromium Code Reviews| Index: ui/base/dragdrop/drag_utils_win.cc |
| diff --git a/ui/base/dragdrop/drag_utils_win.cc b/ui/base/dragdrop/drag_utils_win.cc |
| index 9fedd4202a34ac8e32614fd9de5b9d15a07b8407..e2c5b601bdcd93373c20f964d2edd19ce1070af8 100644 |
| --- a/ui/base/dragdrop/drag_utils_win.cc |
| +++ b/ui/base/dragdrop/drag_utils_win.cc |
| @@ -18,9 +18,14 @@ |
| #include "ui/gfx/geometry/size.h" |
| #include "ui/gfx/image/image_skia.h" |
| #include "ui/gfx/skbitmap_operations.h" |
| +#include "ui/gfx/win/dpi.h" |
| namespace drag_utils { |
| +// The DragDropHelper object on Windows supports images with width upto 300 px. |
| +// Images with widths more than that are clipped. |
| +const int kMaxDragImageWidth = 300; |
| + |
| static void SetDragImageOnDataObject(HBITMAP hbitmap, |
| const gfx::Size& size_in_pixels, |
| const gfx::Vector2d& cursor_offset, |
| @@ -31,9 +36,13 @@ static void SetDragImageOnDataObject(HBITMAP hbitmap, |
| if (SUCCEEDED(rv)) { |
| SHDRAGIMAGE sdi; |
| sdi.sizeDragImage = size_in_pixels.ToSIZE(); |
| + sdi.sizeDragImage.cx = |
| + std::min<int>(kMaxDragImageWidth, sdi.sizeDragImage.cx); |
|
ananta
2015/12/01 02:47:07
If the width is more than 300 the bitmap is displa
|
| sdi.crColorKey = 0xFFFFFFFF; |
| sdi.hbmpDragImage = hbitmap; |
| - sdi.ptOffset = gfx::PointAtOffsetFromOrigin(cursor_offset).ToPOINT(); |
| + gfx::Point point_at_offset_in_pixels = gfx::win::DIPToScreenPoint( |
| + gfx::PointAtOffsetFromOrigin(cursor_offset)); |
| + sdi.ptOffset = point_at_offset_in_pixels.ToPOINT(); |
| helper->InitializeFromBitmap(&sdi, data_object); |
| } |
| } |