diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-25 21:57:37 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-25 21:57:37 +0000 |
commit | ea4a059f8a52705c710cf53a54aa9776a81ef758 (patch) | |
tree | 8ca9c2ff852634a3a2e341549008be16291624c2 /views | |
parent | e4607f05bbe9090122ec35e449969d2cf6cbdbae (diff) | |
download | chromium_src-ea4a059f8a52705c710cf53a54aa9776a81ef758.zip chromium_src-ea4a059f8a52705c710cf53a54aa9776a81ef758.tar.gz chromium_src-ea4a059f8a52705c710cf53a54aa9776a81ef758.tar.bz2 |
Fix a paintstorm that was starving input events and causing things like freezes.
http://crbug.com/74043
TEST=see bug
Review URL: http://codereview.chromium.org/6588021
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@76103 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r-- | views/widget/widget_win.cc | 58 |
1 files changed, 27 insertions, 31 deletions
diff --git a/views/widget/widget_win.cc b/views/widget/widget_win.cc index cddc03b..556c95b 100644 --- a/views/widget/widget_win.cc +++ b/views/widget/widget_win.cc @@ -833,33 +833,9 @@ LRESULT WidgetWin::OnNotify(int w_param, NMHDR* l_param) { } void WidgetWin::OnPaint(HDC dc) { - if (use_layered_buffer_) { - RECT r; - if (!GetUpdateRect(hwnd(), &r, FALSE)) - return; - - // We need to clip to the dirty rect ourselves. - contents_->save(SkCanvas::kClip_SaveFlag); - contents_->ClipRectInt(r.left, r.top, r.right - r.left, - r.bottom - r.top); - GetRootView()->Paint(contents_.get()); - contents_->restore(); - - RECT wr; - GetWindowRect(&wr); - SIZE size = {wr.right - wr.left, wr.bottom - wr.top}; - POINT position = {wr.left, wr.top}; - HDC dib_dc = contents_->getTopPlatformDevice().getBitmapDC(); - POINT zero = {0, 0}; - BLENDFUNCTION blend = {AC_SRC_OVER, 0, layered_alpha_, AC_SRC_ALPHA}; - UpdateLayeredWindow(hwnd(), NULL, &position, &size, dib_dc, &zero, - RGB(0xFF, 0xFF, 0xFF), &blend, ULW_ALPHA); - ValidateRect(hwnd(), &r); - } else { - scoped_ptr<gfx::CanvasPaint> canvas( - gfx::CanvasPaint::CreateCanvasPaint(hwnd())); - GetRootView()->Paint(canvas->AsCanvas()); - } + scoped_ptr<gfx::CanvasPaint> canvas( + gfx::CanvasPaint::CreateCanvasPaint(hwnd())); + GetRootView()->Paint(canvas->AsCanvas()); } LRESULT WidgetWin::OnPowerBroadcast(DWORD power_event, DWORD data) { @@ -1248,10 +1224,30 @@ void WidgetWin::MakeMSG(MSG* msg, UINT message, WPARAM w_param, LPARAM l_param, } void WidgetWin::RedrawInvalidRect() { - RECT r; - if (GetUpdateRect(hwnd(), &r, FALSE)) { - RedrawWindow(hwnd(), &r, NULL, - RDW_INVALIDATE | RDW_UPDATENOW | RDW_NOCHILDREN); + RECT r = { 0, 0, 0, 0 }; + if (GetUpdateRect(hwnd(), &r, FALSE) && !IsRectEmpty(&r)) { + if (use_layered_buffer_) { + // We need to clip to the dirty rect ourselves. + contents_->save(SkCanvas::kClip_SaveFlag); + contents_->ClipRectInt(r.left, r.top, r.right - r.left, + r.bottom - r.top); + GetRootView()->Paint(contents_.get()); + contents_->restore(); + + RECT wr; + GetWindowRect(&wr); + SIZE size = {wr.right - wr.left, wr.bottom - wr.top}; + POINT position = {wr.left, wr.top}; + HDC dib_dc = contents_->getTopPlatformDevice().getBitmapDC(); + POINT zero = {0, 0}; + BLENDFUNCTION blend = {AC_SRC_OVER, 0, layered_alpha_, AC_SRC_ALPHA}; + UpdateLayeredWindow(hwnd(), NULL, &position, &size, dib_dc, &zero, + RGB(0xFF, 0xFF, 0xFF), &blend, ULW_ALPHA); + ValidateRect(hwnd(), &r); + } else { + RedrawWindow(hwnd(), &r, NULL, + RDW_INVALIDATE | RDW_UPDATENOW | RDW_NOCHILDREN); + } } } |