Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Side by Side Diff: chrome/browser/ui/views/tabs/native_view_photobooth_win.cc

Issue 6879013: skia::PlatformCanvas is being deprecated. Going forward we will use gfx::Canvas wherever we need ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 target_bounds.x(), target_bounds.y(), target_bounds.width(), 114 SkIRect::MakeXYWH(target_bounds.x(), target_bounds.y(),
115 target_bounds.height()); 115 target_bounds.width(), target_bounds.height()),
116 canvas->AsCanvasSkia()->skia_canvas());
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) {
124 // Snapshotting a HWND is tricky - if the HWND is clipped (e.g. positioned 125 // Snapshotting a HWND is tricky - if the HWND is clipped (e.g. positioned
125 // partially off-screen) then just blitting from the HWND' DC to the capture 126 // partially off-screen) then just blitting from the HWND' DC to the capture
(...skipping 30 matching lines...) Expand all
156 capture_window_ = views::Widget::CreateWidget(params); 157 capture_window_ = views::Widget::CreateWidget(params);
157 // If the capture window isn't visible, blitting from the TabContents' 158 // If the capture window isn't visible, blitting from the TabContents'
158 // HWND's DC to the capture bitmap produces blankness. 159 // HWND's DC to the capture bitmap produces blankness.
159 capture_window_->Init(NULL, capture_bounds); 160 capture_window_->Init(NULL, capture_bounds);
160 capture_window_->Show(); 161 capture_window_->Show();
161 SetLayeredWindowAttributes( 162 SetLayeredWindowAttributes(
162 capture_window_->GetNativeView(), RGB(0xFF, 0xFF, 0xFF), 0xFF, LWA_ALPHA); 163 capture_window_->GetNativeView(), RGB(0xFF, 0xFF, 0xFF), 0xFF, LWA_ALPHA);
163 164
164 Replace(initial_hwnd); 165 Replace(initial_hwnd);
165 } 166 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/tabs/dragged_tab_view.cc ('k') | chrome/browser/ui/views/tabs/side_tab.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698