 Chromium Code Reviews
 Chromium Code Reviews Issue 8383028:
  ui/gfx: Convert Canvas::ClipRectInt() to use gfx::Rect.  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src
    
  
    Issue 8383028:
  ui/gfx: Convert Canvas::ClipRectInt() to use gfx::Rect.  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src| 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 "ui/views/widget/native_widget_win.h" | 5 #include "ui/views/widget/native_widget_win.h" | 
| 6 | 6 | 
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" | 
| 8 #include "base/system_monitor/system_monitor.h" | 8 #include "base/system_monitor/system_monitor.h" | 
| 9 #include "ui/base/view_prop.h" | 9 #include "ui/base/view_prop.h" | 
| 10 #include "ui/base/win/hwnd_util.h" | 10 #include "ui/base/win/hwnd_util.h" | 
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 444 SetMsgHandled(FALSE); | 444 SetMsgHandled(FALSE); | 
| 445 return 0; | 445 return 0; | 
| 446 } | 446 } | 
| 447 | 447 | 
| 448 void NativeWidgetWin::OnPaint(HDC dc) { | 448 void NativeWidgetWin::OnPaint(HDC dc) { | 
| 449 if (IsLayeredWindow()) { | 449 if (IsLayeredWindow()) { | 
| 450 // We need to clip to the dirty rect ourselves. | 450 // We need to clip to the dirty rect ourselves. | 
| 451 window_contents_->save(SkCanvas::kClip_SaveFlag); | 451 window_contents_->save(SkCanvas::kClip_SaveFlag); | 
| 452 RECT r; | 452 RECT r; | 
| 453 GetUpdateRect(hwnd(), &r, FALSE); | 453 GetUpdateRect(hwnd(), &r, FALSE); | 
| 454 window_contents_->ClipRectInt(r.left, r.top, r.right - r.left, | 454 window_contents_->ClipRectInt( | 
| 
Peter Kasting
2011/10/25 20:24:47
Nit: I think just gfx::Rect(r) works
 
tfarina
2011/10/25 23:52:41
Done.
 | |
| 455 r.bottom - r.top); | 455 gfx::Rect(r.left, r.top, r.right - r.left, r.bottom - r.top)); | 
| 456 listener_->OnPaint(window_contents_.get()); | 456 listener_->OnPaint(window_contents_.get()); | 
| 457 window_contents_->restore(); | 457 window_contents_->restore(); | 
| 458 | 458 | 
| 459 RECT wr; | 459 RECT wr; | 
| 460 GetWindowRect(hwnd(), &wr); | 460 GetWindowRect(hwnd(), &wr); | 
| 461 SIZE size = {wr.right - wr.left, wr.bottom - wr.top}; | 461 SIZE size = {wr.right - wr.left, wr.bottom - wr.top}; | 
| 462 POINT position = {wr.left, wr.top}; | 462 POINT position = {wr.left, wr.top}; | 
| 463 HDC dib_dc = window_contents_->BeginPlatformPaint(); | 463 HDC dib_dc = window_contents_->BeginPlatformPaint(); | 
| 464 POINT zero = {0, 0}; | 464 POINT zero = {0, 0}; | 
| 465 BLENDFUNCTION blend = {AC_SRC_OVER, 0, 125, AC_SRC_ALPHA}; | 465 BLENDFUNCTION blend = {AC_SRC_OVER, 0, 125, AC_SRC_ALPHA}; | 
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 661 if (parent_widget) { | 661 if (parent_widget) { | 
| 662 widget = parent_widget; | 662 widget = parent_widget; | 
| 663 parent_hwnd = ::GetAncestor(parent_hwnd, GA_PARENT); | 663 parent_hwnd = ::GetAncestor(parent_hwnd, GA_PARENT); | 
| 664 } | 664 } | 
| 665 } while (parent_hwnd != NULL && parent_widget != NULL); | 665 } while (parent_hwnd != NULL && parent_widget != NULL); | 
| 666 | 666 | 
| 667 return widget; | 667 return widget; | 
| 668 } | 668 } | 
| 669 | 669 | 
| 670 } // namespace ui | 670 } // namespace ui | 
| OLD | NEW |