| 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 // 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 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 610 } | 610 } |
| 611 const void* bitmap_bits = reinterpret_cast<const char*>(bitmap) | 611 const void* bitmap_bits = reinterpret_cast<const char*>(bitmap) |
| 612 + bitmap->bmiHeader.biSize + color_table_length * sizeof(RGBQUAD); | 612 + bitmap->bmiHeader.biSize + color_table_length * sizeof(RGBQUAD); |
| 613 | 613 |
| 614 gfx::Canvas canvas(gfx::Size(bitmap->bmiHeader.biWidth, | 614 gfx::Canvas canvas(gfx::Size(bitmap->bmiHeader.biWidth, |
| 615 bitmap->bmiHeader.biHeight), | 615 bitmap->bmiHeader.biHeight), |
| 616 1.0f, | 616 1.0f, |
| 617 false); | 617 false); |
| 618 { | 618 { |
| 619 skia::ScopedPlatformPaint scoped_platform_paint(canvas.sk_canvas()); | 619 skia::ScopedPlatformPaint scoped_platform_paint(canvas.sk_canvas()); |
| 620 HDC dc = scoped_platform_paint.GetPlatformSurface(); | 620 HDC dc = scoped_platform_paint.GetNativeDrawingContext(); |
| 621 ::SetDIBitsToDevice(dc, 0, 0, bitmap->bmiHeader.biWidth, | 621 ::SetDIBitsToDevice(dc, 0, 0, bitmap->bmiHeader.biWidth, |
| 622 bitmap->bmiHeader.biHeight, 0, 0, 0, | 622 bitmap->bmiHeader.biHeight, 0, 0, 0, |
| 623 bitmap->bmiHeader.biHeight, bitmap_bits, bitmap, | 623 bitmap->bmiHeader.biHeight, bitmap_bits, bitmap, |
| 624 DIB_RGB_COLORS); | 624 DIB_RGB_COLORS); |
| 625 } | 625 } |
| 626 // Windows doesn't really handle alpha channels well in many situations. When | 626 // Windows doesn't really handle alpha channels well in many situations. When |
| 627 // the source image is < 32 bpp, we force the bitmap to be opaque. When the | 627 // the source image is < 32 bpp, we force the bitmap to be opaque. When the |
| 628 // source image is 32 bpp, the alpha channel might still contain garbage data. | 628 // source image is 32 bpp, the alpha channel might still contain garbage data. |
| 629 // Since Windows uses premultiplied alpha, we scan for instances where | 629 // Since Windows uses premultiplied alpha, we scan for instances where |
| 630 // (R, G, B) > A. If there are any invalid premultiplied colors in the image, | 630 // (R, G, B) > A. If there are any invalid premultiplied colors in the image, |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 882 if (!clipboard_owner_) | 882 if (!clipboard_owner_) |
| 883 return NULL; | 883 return NULL; |
| 884 | 884 |
| 885 if (clipboard_owner_->hwnd() == NULL) | 885 if (clipboard_owner_->hwnd() == NULL) |
| 886 clipboard_owner_->Create(base::Bind(&ClipboardOwnerWndProc)); | 886 clipboard_owner_->Create(base::Bind(&ClipboardOwnerWndProc)); |
| 887 | 887 |
| 888 return clipboard_owner_->hwnd(); | 888 return clipboard_owner_->hwnd(); |
| 889 } | 889 } |
| 890 | 890 |
| 891 } // namespace ui | 891 } // namespace ui |
| OLD | NEW |