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..212ae21cd4ff48164b9f1a19cf401d3170a2d58f 100644 |
| --- a/ui/base/dragdrop/drag_utils_win.cc |
| +++ b/ui/base/dragdrop/drag_utils_win.cc |
| @@ -18,6 +18,7 @@ |
| #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 { |
| @@ -61,11 +62,16 @@ void SetDragImageOnDataObject(const gfx::ImageSkia& image_skia, |
| const gfx::Vector2d& cursor_offset, |
|
sky
2015/11/25 23:38:43
I suspect you need to adjust cursor_offset too.
ananta
2015/12/01 02:42:28
Done.
|
| ui::OSExchangeData* data_object) { |
| DCHECK(data_object && !image_skia.size().IsEmpty()); |
| + |
| + // Attempt to find a bitmap closely matching the current dpi scale. |
| + gfx::ImageSkiaRep image_rep_for_scale = image_skia.GetRepresentation( |
| + gfx::GetDPIScale()); |
| + |
| // InitializeFromBitmap() doesn't expect an alpha channel and is confused |
| // by premultiplied colors, so unpremultiply the bitmap. |
| // SetDragImageOnDataObject(HBITMAP) takes ownership of the bitmap. |
| - HBITMAP bitmap = CreateHBITMAPFromSkBitmap( |
| - SkBitmapOperations::UnPreMultiply(*image_skia.bitmap())); |
| + HBITMAP bitmap = CreateHBITMAPFromSkBitmap(SkBitmapOperations::UnPreMultiply( |
| + image_rep_for_scale.sk_bitmap())); |
| if (bitmap) { |
| // Attach 'bitmap' to the data_object. |
| SetDragImageOnDataObject( |