| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "app/gfx/chrome_canvas.h" | 5 #include "app/gfx/canvas.h" |
| 6 #include "base/gfx/point.h" | 6 #include "base/gfx/point.h" |
| 7 #include "chrome/browser/tab_contents/tab_contents.h" | 7 #include "chrome/browser/tab_contents/tab_contents.h" |
| 8 #include "chrome/browser/views/tabs/hwnd_photobooth.h" | 8 #include "chrome/browser/views/tabs/hwnd_photobooth.h" |
| 9 #include "third_party/skia/include/core/SkBitmap.h" | 9 #include "third_party/skia/include/core/SkBitmap.h" |
| 10 #include "views/widget/widget_win.h" | 10 #include "views/widget/widget_win.h" |
| 11 | 11 |
| 12 namespace { | 12 namespace { |
| 13 | 13 |
| 14 static BOOL CALLBACK MonitorEnumProc(HMONITOR monitor, HDC monitor_dc, | 14 static BOOL CALLBACK MonitorEnumProc(HMONITOR monitor, HDC monitor_dc, |
| 15 RECT* monitor_rect, LPARAM data) { | 15 RECT* monitor_rect, LPARAM data) { |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 // Show the window (it may not be visible). This is the only safe way of | 71 // Show the window (it may not be visible). This is the only safe way of |
| 72 // doing this. ShowWindow does not work. | 72 // doing this. ShowWindow does not work. |
| 73 SetWindowPos(current_hwnd_, NULL, 0, 0, 0, 0, | 73 SetWindowPos(current_hwnd_, NULL, 0, 0, 0, 0, |
| 74 SWP_DEFERERASE | SWP_NOACTIVATE | SWP_NOCOPYBITS | | 74 SWP_DEFERERASE | SWP_NOACTIVATE | SWP_NOCOPYBITS | |
| 75 SWP_NOOWNERZORDER | SWP_NOSENDCHANGING | SWP_NOZORDER | | 75 SWP_NOOWNERZORDER | SWP_NOSENDCHANGING | SWP_NOZORDER | |
| 76 SWP_SHOWWINDOW | SWP_NOSIZE); | 76 SWP_SHOWWINDOW | SWP_NOSIZE); |
| 77 } | 77 } |
| 78 } | 78 } |
| 79 | 79 |
| 80 void HWNDPhotobooth::PaintScreenshotIntoCanvas( | 80 void HWNDPhotobooth::PaintScreenshotIntoCanvas( |
| 81 ChromeCanvas* canvas, | 81 gfx::Canvas* canvas, |
| 82 const gfx::Rect& target_bounds) { | 82 const gfx::Rect& target_bounds) { |
| 83 // Our contained window may have been re-parented. Make sure it belongs to | 83 // Our contained window may have been re-parented. Make sure it belongs to |
| 84 // us until someone calls ReplaceHWND(NULL). | 84 // us until someone calls ReplaceHWND(NULL). |
| 85 if (IsWindow(current_hwnd_) && | 85 if (IsWindow(current_hwnd_) && |
| 86 GetParent(current_hwnd_) != capture_window_->GetNativeView()) { | 86 GetParent(current_hwnd_) != capture_window_->GetNativeView()) { |
| 87 ReplaceHWND(current_hwnd_); | 87 ReplaceHWND(current_hwnd_); |
| 88 } | 88 } |
| 89 | 89 |
| 90 // We compel the contained HWND to paint now, synchronously. We do this to | 90 // We compel the contained HWND to paint now, synchronously. We do this to |
| 91 // populate the device context with valid and current data. | 91 // populate the device context with valid and current data. |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 capture_window_->set_window_ex_style(WS_EX_LAYERED | WS_EX_TOOLWINDOW); | 150 capture_window_->set_window_ex_style(WS_EX_LAYERED | WS_EX_TOOLWINDOW); |
| 151 capture_window_->Init(NULL, capture_bounds, false); | 151 capture_window_->Init(NULL, capture_bounds, false); |
| 152 // If the capture window isn't visible, blitting from the TabContents' | 152 // If the capture window isn't visible, blitting from the TabContents' |
| 153 // HWND's DC to the capture bitmap produces blankness. | 153 // HWND's DC to the capture bitmap produces blankness. |
| 154 capture_window_->Show(); | 154 capture_window_->Show(); |
| 155 SetLayeredWindowAttributes( | 155 SetLayeredWindowAttributes( |
| 156 capture_window_->GetNativeView(), RGB(0xFF, 0xFF, 0xFF), 0xFF, LWA_ALPHA); | 156 capture_window_->GetNativeView(), RGB(0xFF, 0xFF, 0xFF), 0xFF, LWA_ALPHA); |
| 157 | 157 |
| 158 ReplaceHWND(initial_hwnd); | 158 ReplaceHWND(initial_hwnd); |
| 159 } | 159 } |
| OLD | NEW |