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/os_exchange_data_provider_win.h" | 5 #include "ui/base/dragdrop/os_exchange_data_provider_win.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 #include <stdint.h> | 10 #include <stdint.h> |
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
572 base::win::ScopedGetDC screen_dc(NULL); | 572 base::win::ScopedGetDC screen_dc(NULL); |
573 // By giving a null hSection, the |bits| will be destroyed when the | 573 // By giving a null hSection, the |bits| will be destroyed when the |
574 // |hbitmap| is destroyed. | 574 // |hbitmap| is destroyed. |
575 hbitmap = | 575 hbitmap = |
576 CreateDIBSection(screen_dc, reinterpret_cast<BITMAPINFO*>(&header), | 576 CreateDIBSection(screen_dc, reinterpret_cast<BITMAPINFO*>(&header), |
577 DIB_RGB_COLORS, &bits, NULL, 0); | 577 DIB_RGB_COLORS, &bits, NULL, 0); |
578 } | 578 } |
579 if (!hbitmap) | 579 if (!hbitmap) |
580 return; | 580 return; |
581 | 581 |
582 { | 582 memcpy(bits, unpremul_bitmap.getPixels(), height * rowbytes); |
583 SkAutoLockPixels lock(unpremul_bitmap); | |
584 memcpy(bits, unpremul_bitmap.getPixels(), height * rowbytes); | |
585 } | |
586 | 583 |
587 base::win::ScopedComPtr<IDragSourceHelper> helper; | 584 base::win::ScopedComPtr<IDragSourceHelper> helper; |
588 HRESULT rv = CoCreateInstance(CLSID_DragDropHelper, 0, CLSCTX_INPROC_SERVER, | 585 HRESULT rv = CoCreateInstance(CLSID_DragDropHelper, 0, CLSCTX_INPROC_SERVER, |
589 IID_IDragSourceHelper, helper.ReceiveVoid()); | 586 IID_IDragSourceHelper, helper.ReceiveVoid()); |
590 if (!SUCCEEDED(rv)) | 587 if (!SUCCEEDED(rv)) |
591 return; | 588 return; |
592 | 589 |
593 // InitializeFromBitmap() takes ownership of |hbitmap|. | 590 // InitializeFromBitmap() takes ownership of |hbitmap|. |
594 SHDRAGIMAGE sdi; | 591 SHDRAGIMAGE sdi; |
595 sdi.sizeDragImage.cx = width; | 592 sdi.sizeDragImage.cx = width; |
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1121 std::min(file_name.size(), static_cast<size_t>(MAX_PATH - 1u))); | 1118 std::min(file_name.size(), static_cast<size_t>(MAX_PATH - 1u))); |
1122 | 1119 |
1123 STGMEDIUM* storage = new STGMEDIUM; | 1120 STGMEDIUM* storage = new STGMEDIUM; |
1124 storage->tymed = TYMED_HGLOBAL; | 1121 storage->tymed = TYMED_HGLOBAL; |
1125 storage->hGlobal = hdata; | 1122 storage->hGlobal = hdata; |
1126 storage->pUnkForRelease = NULL; | 1123 storage->pUnkForRelease = NULL; |
1127 return storage; | 1124 return storage; |
1128 } | 1125 } |
1129 | 1126 |
1130 } // namespace ui | 1127 } // namespace ui |
OLD | NEW |