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

Side by Side Diff: views/widget/native_widget_win.cc

Issue 8122013: Allow CanvasSkia to bind to an existing SkCanvas. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: 1 more fix Created 9 years, 2 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 "views/widget/native_widget_win.h" 5 #include "views/widget/native_widget_win.h"
6 6
7 #include <dwmapi.h> 7 #include <dwmapi.h>
8 #include <shellapi.h> 8 #include <shellapi.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 2285 matching lines...) Expand 10 before | Expand all | Expand 10 after
2296 RDW_INVALIDATE | RDW_UPDATENOW | RDW_NOCHILDREN); 2296 RDW_INVALIDATE | RDW_UPDATENOW | RDW_NOCHILDREN);
2297 } 2297 }
2298 } 2298 }
2299 } 2299 }
2300 2300
2301 void NativeWidgetWin::RedrawLayeredWindowContents() { 2301 void NativeWidgetWin::RedrawLayeredWindowContents() {
2302 if (invalid_rect_.IsEmpty()) 2302 if (invalid_rect_.IsEmpty())
2303 return; 2303 return;
2304 2304
2305 // We need to clip to the dirty rect ourselves. 2305 // We need to clip to the dirty rect ourselves.
2306 layered_window_contents_->save(SkCanvas::kClip_SaveFlag); 2306 layered_window_contents_->sk_canvas()->save(SkCanvas::kClip_SaveFlag);
2307 layered_window_contents_->ClipRectInt(invalid_rect_.x(), 2307 layered_window_contents_->ClipRectInt(invalid_rect_.x(),
2308 invalid_rect_.y(), 2308 invalid_rect_.y(),
2309 invalid_rect_.width(), 2309 invalid_rect_.width(),
2310 invalid_rect_.height()); 2310 invalid_rect_.height());
2311 GetWidget()->GetRootView()->Paint(layered_window_contents_.get()); 2311 GetWidget()->GetRootView()->Paint(layered_window_contents_.get());
2312 layered_window_contents_->restore(); 2312 layered_window_contents_->sk_canvas()->restore();
2313 2313
2314 RECT wr; 2314 RECT wr;
2315 GetWindowRect(&wr); 2315 GetWindowRect(&wr);
2316 SIZE size = {wr.right - wr.left, wr.bottom - wr.top}; 2316 SIZE size = {wr.right - wr.left, wr.bottom - wr.top};
2317 POINT position = {wr.left, wr.top}; 2317 POINT position = {wr.left, wr.top};
2318 HDC dib_dc = skia::BeginPlatformPaint(layered_window_contents_.get()); 2318 HDC dib_dc = skia::BeginPlatformPaint(layered_window_contents_->sk_canvas());
2319 POINT zero = {0, 0}; 2319 POINT zero = {0, 0};
2320 BLENDFUNCTION blend = {AC_SRC_OVER, 0, layered_alpha_, AC_SRC_ALPHA}; 2320 BLENDFUNCTION blend = {AC_SRC_OVER, 0, layered_alpha_, AC_SRC_ALPHA};
2321 UpdateLayeredWindow(hwnd(), NULL, &position, &size, dib_dc, &zero, 2321 UpdateLayeredWindow(hwnd(), NULL, &position, &size, dib_dc, &zero,
2322 RGB(0xFF, 0xFF, 0xFF), &blend, ULW_ALPHA); 2322 RGB(0xFF, 0xFF, 0xFF), &blend, ULW_ALPHA);
2323 invalid_rect_.SetRect(0, 0, 0, 0); 2323 invalid_rect_.SetRect(0, 0, 0, 0);
2324 skia::EndPlatformPaint(layered_window_contents_.get()); 2324 skia::EndPlatformPaint(layered_window_contents_->sk_canvas());
2325 } 2325 }
2326 2326
2327 void NativeWidgetWin::LockUpdates() { 2327 void NativeWidgetWin::LockUpdates() {
2328 // We skip locked updates when Aero is on for two reasons: 2328 // We skip locked updates when Aero is on for two reasons:
2329 // 1. Because it isn't necessary 2329 // 1. Because it isn't necessary
2330 // 2. Because toggling the WS_VISIBLE flag may occur while the GPU process is 2330 // 2. Because toggling the WS_VISIBLE flag may occur while the GPU process is
2331 // attempting to present a child window's backbuffer onscreen. When these 2331 // attempting to present a child window's backbuffer onscreen. When these
2332 // two actions race with one another, the child window will either flicker 2332 // two actions race with one another, the child window will either flicker
2333 // or will simply stop updating entirely. 2333 // or will simply stop updating entirely.
2334 if (!IsAeroGlassEnabled() && ++lock_updates_count_ == 1) { 2334 if (!IsAeroGlassEnabled() && ++lock_updates_count_ == 1) {
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
2607 return (GetKeyState(VK_LBUTTON) & 0x80) || 2607 return (GetKeyState(VK_LBUTTON) & 0x80) ||
2608 (GetKeyState(VK_RBUTTON) & 0x80) || 2608 (GetKeyState(VK_RBUTTON) & 0x80) ||
2609 (GetKeyState(VK_MBUTTON) & 0x80) || 2609 (GetKeyState(VK_MBUTTON) & 0x80) ||
2610 (GetKeyState(VK_XBUTTON1) & 0x80) || 2610 (GetKeyState(VK_XBUTTON1) & 0x80) ||
2611 (GetKeyState(VK_XBUTTON2) & 0x80); 2611 (GetKeyState(VK_XBUTTON2) & 0x80);
2612 } 2612 }
2613 2613
2614 } // namespace internal 2614 } // namespace internal
2615 2615
2616 } // namespace views 2616 } // namespace views
OLDNEW
« ui/gfx/canvas.h ('K') | « views/view_unittest.cc ('k') | views/widget/root_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698