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 "ui/base/system_monitor/system_monitor.h" | 8 #include "ui/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 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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(r.left, r.top, r.right - r.left, |
455 r.bottom - r.top); | 455 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_->getTopPlatformDevice().getBitmapDC(); | 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}; |
466 UpdateLayeredWindow(hwnd(), NULL, &position, &size, dib_dc, &zero, | 466 UpdateLayeredWindow(hwnd(), NULL, &position, &size, dib_dc, &zero, |
467 RGB(0xFF, 0xFF, 0xFF), &blend, ULW_ALPHA); | 467 RGB(0xFF, 0xFF, 0xFF), &blend, ULW_ALPHA); |
| 468 window_contents_->endPlatformPaint(); |
468 } else { | 469 } else { |
469 scoped_ptr<gfx::CanvasPaint> canvas( | 470 scoped_ptr<gfx::CanvasPaint> canvas( |
470 gfx::CanvasPaint::CreateCanvasPaint(hwnd())); | 471 gfx::CanvasPaint::CreateCanvasPaint(hwnd())); |
471 listener_->OnPaint(canvas->AsCanvas()); | 472 listener_->OnPaint(canvas->AsCanvas()); |
472 } | 473 } |
473 } | 474 } |
474 | 475 |
475 LRESULT NativeWidgetWin::OnPowerBroadcast(DWORD power_event, DWORD data) { | 476 LRESULT NativeWidgetWin::OnPowerBroadcast(DWORD power_event, DWORD data) { |
476 SystemMonitor* monitor = SystemMonitor::Get(); | 477 SystemMonitor* monitor = SystemMonitor::Get(); |
477 if (monitor) | 478 if (monitor) |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
662 if (parent_widget) { | 663 if (parent_widget) { |
663 widget = parent_widget; | 664 widget = parent_widget; |
664 parent_hwnd = ::GetAncestor(parent_hwnd, GA_PARENT); | 665 parent_hwnd = ::GetAncestor(parent_hwnd, GA_PARENT); |
665 } | 666 } |
666 } while (parent_hwnd != NULL && parent_widget != NULL); | 667 } while (parent_hwnd != NULL && parent_widget != NULL); |
667 | 668 |
668 return widget; | 669 return widget; |
669 } | 670 } |
670 | 671 |
671 } // namespace ui | 672 } // namespace ui |
OLD | NEW |