Index: content/browser/renderer_host/render_widget_host_view_win.cc |
=================================================================== |
--- content/browser/renderer_host/render_widget_host_view_win.cc (revision 158861) |
+++ content/browser/renderer_host/render_widget_host_view_win.cc (working copy) |
@@ -1305,6 +1305,14 @@ |
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; |
@@ -1315,9 +1323,6 @@ |
// 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) && |
@@ -1329,6 +1334,12 @@ |
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)); |
@@ -1338,28 +1349,15 @@ |
// 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()); |