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 #include "chrome/browser/ui/views/tabs/native_view_photobooth_win.h" | 5 #include "chrome/browser/ui/views/tabs/native_view_photobooth_win.h" |
6 | 6 |
7 #include "content/browser/tab_contents/tab_contents.h" | 7 #include "content/browser/tab_contents/tab_contents.h" |
8 #include "third_party/skia/include/core/SkBitmap.h" | 8 #include "third_party/skia/include/core/SkBitmap.h" |
9 #include "ui/gfx/canvas_skia.h" | 9 #include "ui/gfx/canvas_skia.h" |
10 #include "ui/gfx/point.h" | 10 #include "ui/gfx/point.h" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
103 // canvas' DIB. | 103 // canvas' DIB. |
104 HDC target_dc = canvas->BeginPlatformPaint(); | 104 HDC target_dc = canvas->BeginPlatformPaint(); |
105 HDC source_dc = GetDC(current_hwnd_); | 105 HDC source_dc = GetDC(current_hwnd_); |
106 RECT window_rect = {0}; | 106 RECT window_rect = {0}; |
107 GetWindowRect(current_hwnd_, &window_rect); | 107 GetWindowRect(current_hwnd_, &window_rect); |
108 BitBlt(target_dc, target_bounds.x(), target_bounds.y(), | 108 BitBlt(target_dc, target_bounds.x(), target_bounds.y(), |
109 target_bounds.width(), target_bounds.height(), source_dc, 0, 0, | 109 target_bounds.width(), target_bounds.height(), source_dc, 0, 0, |
110 SRCCOPY); | 110 SRCCOPY); |
111 // Windows screws up the alpha channel on all text it draws, and so we need | 111 // Windows screws up the alpha channel on all text it draws, and so we need |
112 // to call makeOpaque _after_ the blit to correct for this. | 112 // to call makeOpaque _after_ the blit to correct for this. |
113 canvas->AsCanvasSkia()->getTopPlatformDevice().makeOpaque( | 113 skia::MakeOpaque( |
114 &canvas->AsCanvasSkia()->getTopDevice(), | |
alokp
2011/05/19 18:15:15
could skia::MakeOpaque take canvas argument instea
Jeff Timanus
2011/05/19 20:38:29
Done.
| |
114 target_bounds.x(), target_bounds.y(), target_bounds.width(), | 115 target_bounds.x(), target_bounds.y(), target_bounds.width(), |
115 target_bounds.height()); | 116 target_bounds.height()); |
116 ReleaseDC(current_hwnd_, source_dc); | 117 ReleaseDC(current_hwnd_, source_dc); |
117 canvas->EndPlatformPaint(); | 118 canvas->EndPlatformPaint(); |
118 } | 119 } |
119 | 120 |
120 /////////////////////////////////////////////////////////////////////////////// | 121 /////////////////////////////////////////////////////////////////////////////// |
121 // NativeViewPhotoboothWin, private: | 122 // NativeViewPhotoboothWin, private: |
122 | 123 |
123 void NativeViewPhotoboothWin::CreateCaptureWindow(HWND initial_hwnd) { | 124 void NativeViewPhotoboothWin::CreateCaptureWindow(HWND initial_hwnd) { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
157 params.bounds = capture_bounds; | 158 params.bounds = capture_bounds; |
158 capture_window_->Init(params); | 159 capture_window_->Init(params); |
159 // If the capture window isn't visible, blitting from the TabContents' | 160 // If the capture window isn't visible, blitting from the TabContents' |
160 // HWND's DC to the capture bitmap produces blankness. | 161 // HWND's DC to the capture bitmap produces blankness. |
161 capture_window_->Show(); | 162 capture_window_->Show(); |
162 SetLayeredWindowAttributes( | 163 SetLayeredWindowAttributes( |
163 capture_window_->GetNativeView(), RGB(0xFF, 0xFF, 0xFF), 0xFF, LWA_ALPHA); | 164 capture_window_->GetNativeView(), RGB(0xFF, 0xFF, 0xFF), 0xFF, LWA_ALPHA); |
164 | 165 |
165 Replace(initial_hwnd); | 166 Replace(initial_hwnd); |
166 } | 167 } |
OLD | NEW |