| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/base/dragdrop/drag_utils.h" | 5 #include "ui/base/dragdrop/drag_utils.h" |
| 6 | 6 |
| 7 #include <objidl.h> | 7 #include <objidl.h> |
| 8 #include <shlobj.h> | 8 #include <shlobj.h> |
| 9 #include <shobjidl.h> | 9 #include <shobjidl.h> |
| 10 | 10 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 DCHECK(data_object && !size.IsEmpty()); | 61 DCHECK(data_object && !size.IsEmpty()); |
| 62 // InitializeFromBitmap() doesn't expect an alpha channel and is confused | 62 // InitializeFromBitmap() doesn't expect an alpha channel and is confused |
| 63 // by premultiplied colors, so unpremultiply the bitmap. | 63 // by premultiplied colors, so unpremultiply the bitmap. |
| 64 // SetDragImageOnDataObject(HBITMAP) takes ownership of the bitmap. | 64 // SetDragImageOnDataObject(HBITMAP) takes ownership of the bitmap. |
| 65 HBITMAP bitmap = CreateHBITMAPFromSkBitmap( | 65 HBITMAP bitmap = CreateHBITMAPFromSkBitmap( |
| 66 SkBitmapOperations::UnPreMultiply(*image_skia.bitmap())); | 66 SkBitmapOperations::UnPreMultiply(*image_skia.bitmap())); |
| 67 | 67 |
| 68 // Attach 'bitmap' to the data_object. | 68 // Attach 'bitmap' to the data_object. |
| 69 SetDragImageOnDataObject(bitmap, size, cursor_offset, | 69 SetDragImageOnDataObject(bitmap, size, cursor_offset, |
| 70 ui::OSExchangeDataProviderWin::GetIDataObject(*data_object)); | 70 ui::OSExchangeDataProviderWin::GetIDataObject(*data_object)); |
| 71 |
| 72 #if defined(USE_AURA) |
| 73 // TODO: the above code is used in non-Ash, while below is used in Ash. If we |
| 74 // could figure this context out then we wouldn't do unnecessary work. However |
| 75 // as it stands getting this information in ui/base would be a layering |
| 76 // violation. |
| 77 data_object->provider().SetDragImage(image_skia, cursor_offset); |
| 78 #endif |
| 71 } | 79 } |
| 72 | 80 |
| 73 } // namespace drag_utils | 81 } // namespace drag_utils |
| OLD | NEW |