Chromium Code Reviews| Index: chrome/browser/ui/window_snapshot/window_snapshot_win.cc |
| =================================================================== |
| --- chrome/browser/ui/window_snapshot/window_snapshot_win.cc (revision 120644) |
| +++ chrome/browser/ui/window_snapshot/window_snapshot_win.cc (working copy) |
| @@ -43,36 +43,31 @@ |
| &hdr); |
| unsigned char *bit_ptr = NULL; |
| base::win::ScopedBitmap bitmap( |
| - CreateDIBSection(mem_hdc, |
| + CreateDIBSection(mem_hdc.Get(), |
| reinterpret_cast<BITMAPINFO*>(&hdr), |
| DIB_RGB_COLORS, |
| reinterpret_cast<void **>(&bit_ptr), |
| NULL, 0)); |
| - base::win::ScopedSelectObject select_bitmap(mem_hdc, bitmap); |
| + base::win::ScopedSelectObject select_bitmap(mem_hdc.Get(), bitmap); |
| // Clear the bitmap to white (so that rounded corners on windows |
| // show up on a white background, and strangely-shaped windows |
| // look reasonable). Not capturing an alpha mask saves a |
| // bit of space. |
| - PatBlt(mem_hdc, 0, 0, snapshot_bounds.width(), snapshot_bounds.height(), |
| + PatBlt(mem_hdc.Get(), 0, 0, snapshot_bounds.width(), snapshot_bounds.height(), |
| WHITENESS); |
| - // Grab a copy of the window |
| - // First, see if PrintWindow is defined (it's not in Windows 2000). |
| - typedef BOOL (WINAPI *PrintWindowPointer)(HWND, HDC, UINT); |
| - PrintWindowPointer print_window = |
|
cpu_(ooo_6.6-7.5)
2012/02/08 00:03:20
Removing win2k hack.
|
| - reinterpret_cast<PrintWindowPointer>( |
| - GetProcAddress(GetModuleHandle(L"User32.dll"), "PrintWindow")); |
| - // If PrintWindow is defined, use it. It will work on partially |
| - // obscured windows, and works better for out of process sub-windows. |
| - // Otherwise grab the bits we can get with BitBlt; it's better |
| - // than nothing and will work fine in the average case (window is |
| - // completely on screen). |
| - if (snapshot_bounds.origin() == gfx::Point() && print_window) |
| - (*print_window)(window_handle, mem_hdc, 0); |
| - else |
| - BitBlt(mem_hdc, 0, 0, snapshot_bounds.width(), snapshot_bounds.height(), |
| - window_hdc, snapshot_bounds.x(), snapshot_bounds.y(), SRCCOPY); |
| + if (snapshot_bounds.origin() == gfx::Point()) { |
|
Peter Kasting
2012/02/08 00:38:49
Nit: If you reverse this conditional you can combi
cpu_(ooo_6.6-7.5)
2012/02/10 19:41:55
Done.
|
| + if (!PrintWindow(window_handle, mem_hdc.Get(), 0)) { |
| + NOTREACHED(); |
| + } |
| + } else { |
| + BitBlt(mem_hdc.Get(), |
| + 0, 0, snapshot_bounds.width(), snapshot_bounds.height(), |
| + window_hdc, |
| + snapshot_bounds.x(), snapshot_bounds.y(), |
| + SRCCOPY); |
| + } |
| // We now have a copy of the window contents in a DIB, so |
| // encode it into a useful format for posting to the bug report |