Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Side by Side Diff: ui/base/clipboard/clipboard_win.cc

Issue 2823003002: SkBitmap and SkPixelRef no longer need lock/unlock (Closed)
Patch Set: win fix after rebase Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 // Many of these functions are based on those found in 5 // Many of these functions are based on those found in
6 // webkit/port/platform/PasteboardWin.cpp 6 // webkit/port/platform/PasteboardWin.cpp
7 7
8 #include "ui/base/clipboard/clipboard_win.h" 8 #include "ui/base/clipboard/clipboard_win.h"
9 9
10 #include <shellapi.h> 10 #include <shellapi.h>
(...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after
801 bm_info.bmiHeader.biCompression = BI_RGB; 801 bm_info.bmiHeader.biCompression = BI_RGB;
802 802
803 // ::CreateDIBSection allocates memory for us to copy our bitmap into. 803 // ::CreateDIBSection allocates memory for us to copy our bitmap into.
804 // Unfortunately, we can't write the created bitmap to the clipboard, 804 // Unfortunately, we can't write the created bitmap to the clipboard,
805 // (see http://msdn2.microsoft.com/en-us/library/ms532292.aspx) 805 // (see http://msdn2.microsoft.com/en-us/library/ms532292.aspx)
806 void* bits; 806 void* bits;
807 HBITMAP source_hbitmap = 807 HBITMAP source_hbitmap =
808 ::CreateDIBSection(dc, &bm_info, DIB_RGB_COLORS, &bits, NULL, 0); 808 ::CreateDIBSection(dc, &bm_info, DIB_RGB_COLORS, &bits, NULL, 0);
809 809
810 if (bits && source_hbitmap) { 810 if (bits && source_hbitmap) {
811 { 811 // Copy the bitmap out of shared memory and into GDI
812 SkAutoLockPixels bitmap_lock(bitmap); 812 memcpy(bits, bitmap.getPixels(), bitmap.getSize());
813 // Copy the bitmap out of shared memory and into GDI
814 memcpy(bits, bitmap.getPixels(), bitmap.getSize());
815 }
816 813
817 // Now we have an HBITMAP, we can write it to the clipboard 814 // Now we have an HBITMAP, we can write it to the clipboard
818 WriteBitmapFromHandle(source_hbitmap, 815 WriteBitmapFromHandle(source_hbitmap,
819 gfx::Size(bitmap.width(), bitmap.height())); 816 gfx::Size(bitmap.width(), bitmap.height()));
820 } 817 }
821 818
822 ::DeleteObject(source_hbitmap); 819 ::DeleteObject(source_hbitmap);
823 ::ReleaseDC(NULL, dc); 820 ::ReleaseDC(NULL, dc);
824 } 821 }
825 822
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
898 if (!clipboard_owner_) 895 if (!clipboard_owner_)
899 return NULL; 896 return NULL;
900 897
901 if (clipboard_owner_->hwnd() == NULL) 898 if (clipboard_owner_->hwnd() == NULL)
902 clipboard_owner_->Create(base::Bind(&ClipboardOwnerWndProc)); 899 clipboard_owner_->Create(base::Bind(&ClipboardOwnerWndProc));
903 900
904 return clipboard_owner_->hwnd(); 901 return clipboard_owner_->hwnd();
905 } 902 }
906 903
907 } // namespace ui 904 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/clipboard/clipboard_test_template.h ('k') | ui/base/dragdrop/os_exchange_data_provider_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698