| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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.h" | 8 #include "ui/base/clipboard/clipboard.h" |
| 9 | 9 |
| 10 #include <shlobj.h> | 10 #include <shlobj.h> |
| (...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 ::SetDIBitsToDevice(dc, 0, 0, bitmap->bmiHeader.biWidth, | 472 ::SetDIBitsToDevice(dc, 0, 0, bitmap->bmiHeader.biWidth, |
| 473 bitmap->bmiHeader.biHeight, 0, 0, 0, | 473 bitmap->bmiHeader.biHeight, 0, 0, 0, |
| 474 bitmap->bmiHeader.biHeight, bitmap_bits, bitmap, | 474 bitmap->bmiHeader.biHeight, bitmap_bits, bitmap, |
| 475 DIB_RGB_COLORS); | 475 DIB_RGB_COLORS); |
| 476 } | 476 } |
| 477 // SetDIBitsToDevice doesn't properly set alpha values for bitmaps with | 477 // SetDIBitsToDevice doesn't properly set alpha values for bitmaps with |
| 478 // depth < 32bpp so manually fix it up. | 478 // depth < 32bpp so manually fix it up. |
| 479 if (bitmap->bmiHeader.biBitCount < 32) { | 479 if (bitmap->bmiHeader.biBitCount < 32) { |
| 480 const SkBitmap& device_bitmap = canvas.getDevice()->accessBitmap(true); | 480 const SkBitmap& device_bitmap = canvas.getDevice()->accessBitmap(true); |
| 481 SkAutoLockPixels lock(device_bitmap); | 481 SkAutoLockPixels lock(device_bitmap); |
| 482 for (int i = 0; i < device_bitmap.height(); ++i) { | 482 for (int x = 0; x < device_bitmap.width(); ++x) { |
| 483 for (int j = 0; j < device_bitmap.width(); ++j) { | 483 for (int y = 0; y < device_bitmap.height(); ++y) { |
| 484 *device_bitmap.getAddr32(i, j) = | 484 *device_bitmap.getAddr32(x, y) = |
| 485 SkColorSetA(*device_bitmap.getAddr32(i, j), 0xFF); | 485 SkColorSetA(*device_bitmap.getAddr32(x, y), 0xFF); |
| 486 } | 486 } |
| 487 } | 487 } |
| 488 } | 488 } |
| 489 return canvas.ExtractBitmap(); | 489 return canvas.ExtractBitmap(); |
| 490 } | 490 } |
| 491 | 491 |
| 492 void Clipboard::ReadBookmark(string16* title, std::string* url) const { | 492 void Clipboard::ReadBookmark(string16* title, std::string* url) const { |
| 493 if (title) | 493 if (title) |
| 494 title->clear(); | 494 title->clear(); |
| 495 | 495 |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 686 clipboard_owner_ = ::CreateWindow(L"ClipboardOwnerWindowClass", | 686 clipboard_owner_ = ::CreateWindow(L"ClipboardOwnerWindowClass", |
| 687 L"ClipboardOwnerWindow", | 687 L"ClipboardOwnerWindow", |
| 688 0, 0, 0, 0, 0, | 688 0, 0, 0, 0, 0, |
| 689 HWND_MESSAGE, | 689 HWND_MESSAGE, |
| 690 0, 0, 0); | 690 0, 0, 0); |
| 691 } | 691 } |
| 692 return clipboard_owner_; | 692 return clipboard_owner_; |
| 693 } | 693 } |
| 694 | 694 |
| 695 } // namespace ui | 695 } // namespace ui |
| OLD | NEW |