diff options
author | apatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-25 18:51:30 +0000 |
---|---|---|
committer | apatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-25 18:51:30 +0000 |
commit | 24ff59bb50349714e7b9f84d43eb156b3ed88ce2 (patch) | |
tree | 6b4c19da0bedd3de45ea7210c154d53bda8ca171 /content | |
parent | 223d78bd6e456ab493761d88d53cd58b5d55258a (diff) | |
download | chromium_src-24ff59bb50349714e7b9f84d43eb156b3ed88ce2.zip chromium_src-24ff59bb50349714e7b9f84d43eb156b3ed88ce2.tar.gz chromium_src-24ff59bb50349714e7b9f84d43eb156b3ed88ce2.tar.bz2 |
Revert 157915 to see if it caused issue 152019 - Avoid calling RWHVWin::GetBackingStore when accelerated compositing is enabled.
It's milliseconds expensive and it's not needed in this case.
Review URL: https://chromiumcodereview.appspot.com/10967027
TBR=apatrick@chromium.org
Review URL: https://codereview.chromium.org/10982033
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@158624 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r-- | content/browser/renderer_host/render_widget_host_view_win.cc | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/content/browser/renderer_host/render_widget_host_view_win.cc b/content/browser/renderer_host/render_widget_host_view_win.cc index 1b82608..f593ddd 100644 --- a/content/browser/renderer_host/render_widget_host_view_win.cc +++ b/content/browser/renderer_host/render_widget_host_view_win.cc @@ -1306,14 +1306,6 @@ void RenderWidgetHostViewWin::OnDestroy() { void RenderWidgetHostViewWin::OnPaint(HDC unused_dc) { TRACE_EVENT0("browser", "RenderWidgetHostViewWin::OnPaint"); - - // Grab the region to paint before creation of paint_dc since it clears the - // damage region. - base::win::ScopedGDIObject<HRGN> damage_region(CreateRectRgn(0, 0, 0, 0)); - GetUpdateRgn(damage_region, FALSE); - - CPaintDC paint_dc(m_hWnd); - if (!render_widget_host_) return; @@ -1324,6 +1316,9 @@ void RenderWidgetHostViewWin::OnPaint(HDC unused_dc) { // do here is clear borders during resize. if (compositor_host_window_ && render_widget_host_->is_accelerated_compositing_active()) { + // We initialize paint_dc here so that BeginPaint()/EndPaint() + // get called to validate the region. + CPaintDC paint_dc(m_hWnd); RECT host_rect, child_rect; GetClientRect(&host_rect); if (::GetClientRect(compositor_host_window_, &child_rect) && @@ -1335,12 +1330,6 @@ void RenderWidgetHostViewWin::OnPaint(HDC unused_dc) { return; } - if (accelerated_surface_.get() && - render_widget_host_->is_accelerated_compositing_active()) { - AcceleratedPaint(paint_dc.m_hDC); - return; - } - about_to_validate_and_paint_ = true; BackingStoreWin* backing_store = static_cast<BackingStoreWin*>( render_widget_host_->GetBackingStore(true)); @@ -1350,15 +1339,28 @@ void RenderWidgetHostViewWin::OnPaint(HDC unused_dc) { // changes and repaint them. about_to_validate_and_paint_ = false; + // Grab the region to paint before creation of paint_dc since it clears the + // damage region. + base::win::ScopedGDIObject<HRGN> damage_region(CreateRectRgn(0, 0, 0, 0)); + GetUpdateRgn(damage_region, FALSE); + if (compositor_host_window_ && hide_compositor_window_at_next_paint_) { ::ShowWindow(compositor_host_window_, SW_HIDE); hide_compositor_window_at_next_paint_ = false; } + CPaintDC paint_dc(m_hWnd); + gfx::Rect damaged_rect(paint_dc.m_ps.rcPaint); if (damaged_rect.IsEmpty()) return; + if (accelerated_surface_.get() && + render_widget_host_->is_accelerated_compositing_active()) { + AcceleratedPaint(paint_dc.m_hDC); + return; + } + if (backing_store) { gfx::Rect bitmap_rect(gfx::Point(), backing_store->size()); |