Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(478)

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_win.cc

Issue 10996033: Revert 158624 - Revert 157915 to see if it caused issue 152019 - Avoid calling RWHVWin::GetBackingS… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/renderer_host/render_widget_host_view_win.h" 5 #include "content/browser/renderer_host/render_widget_host_view_win.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 #include <peninputpanel_i.c> 9 #include <peninputpanel_i.c>
10 #include <stack> 10 #include <stack>
(...skipping 1287 matching lines...) Expand 10 before | Expand all | Expand 10 after
1298 } 1298 }
1299 1299
1300 CleanupCompositorWindow(); 1300 CleanupCompositorWindow();
1301 1301
1302 ResetTooltip(); 1302 ResetTooltip();
1303 TrackMouseLeave(false); 1303 TrackMouseLeave(false);
1304 } 1304 }
1305 1305
1306 void RenderWidgetHostViewWin::OnPaint(HDC unused_dc) { 1306 void RenderWidgetHostViewWin::OnPaint(HDC unused_dc) {
1307 TRACE_EVENT0("browser", "RenderWidgetHostViewWin::OnPaint"); 1307 TRACE_EVENT0("browser", "RenderWidgetHostViewWin::OnPaint");
1308
1309 // Grab the region to paint before creation of paint_dc since it clears the
1310 // damage region.
1311 base::win::ScopedGDIObject<HRGN> damage_region(CreateRectRgn(0, 0, 0, 0));
1312 GetUpdateRgn(damage_region, FALSE);
1313
1314 CPaintDC paint_dc(m_hWnd);
1315
1308 if (!render_widget_host_) 1316 if (!render_widget_host_)
1309 return; 1317 return;
1310 1318
1311 DCHECK(render_widget_host_->GetProcess()->HasConnection()); 1319 DCHECK(render_widget_host_->GetProcess()->HasConnection());
1312 1320
1313 // If the GPU process is rendering to a child window, compositing is 1321 // If the GPU process is rendering to a child window, compositing is
1314 // already triggered by damage to compositor_host_window_, so all we need to 1322 // already triggered by damage to compositor_host_window_, so all we need to
1315 // do here is clear borders during resize. 1323 // do here is clear borders during resize.
1316 if (compositor_host_window_ && 1324 if (compositor_host_window_ &&
1317 render_widget_host_->is_accelerated_compositing_active()) { 1325 render_widget_host_->is_accelerated_compositing_active()) {
1318 // We initialize paint_dc here so that BeginPaint()/EndPaint()
1319 // get called to validate the region.
1320 CPaintDC paint_dc(m_hWnd);
1321 RECT host_rect, child_rect; 1326 RECT host_rect, child_rect;
1322 GetClientRect(&host_rect); 1327 GetClientRect(&host_rect);
1323 if (::GetClientRect(compositor_host_window_, &child_rect) && 1328 if (::GetClientRect(compositor_host_window_, &child_rect) &&
1324 (child_rect.right < host_rect.right || 1329 (child_rect.right < host_rect.right ||
1325 child_rect.bottom < host_rect.bottom)) { 1330 child_rect.bottom < host_rect.bottom)) {
1326 paint_dc.FillRect(&host_rect, 1331 paint_dc.FillRect(&host_rect,
1327 reinterpret_cast<HBRUSH>(GetStockObject(WHITE_BRUSH))); 1332 reinterpret_cast<HBRUSH>(GetStockObject(WHITE_BRUSH)));
1328 } 1333 }
1329 return; 1334 return;
1330 } 1335 }
1331 1336
1337 if (accelerated_surface_.get() &&
1338 render_widget_host_->is_accelerated_compositing_active()) {
1339 AcceleratedPaint(paint_dc.m_hDC);
1340 return;
1341 }
1342
1332 about_to_validate_and_paint_ = true; 1343 about_to_validate_and_paint_ = true;
1333 BackingStoreWin* backing_store = static_cast<BackingStoreWin*>( 1344 BackingStoreWin* backing_store = static_cast<BackingStoreWin*>(
1334 render_widget_host_->GetBackingStore(true)); 1345 render_widget_host_->GetBackingStore(true));
1335 1346
1336 // We initialize |paint_dc| (and thus call BeginPaint()) after calling 1347 // We initialize |paint_dc| (and thus call BeginPaint()) after calling
1337 // GetBackingStore(), so that if it updates the invalid rect we'll catch the 1348 // GetBackingStore(), so that if it updates the invalid rect we'll catch the
1338 // changes and repaint them. 1349 // changes and repaint them.
1339 about_to_validate_and_paint_ = false; 1350 about_to_validate_and_paint_ = false;
1340 1351
1341 // Grab the region to paint before creation of paint_dc since it clears the
1342 // damage region.
1343 base::win::ScopedGDIObject<HRGN> damage_region(CreateRectRgn(0, 0, 0, 0));
1344 GetUpdateRgn(damage_region, FALSE);
1345
1346 if (compositor_host_window_ && hide_compositor_window_at_next_paint_) { 1352 if (compositor_host_window_ && hide_compositor_window_at_next_paint_) {
1347 ::ShowWindow(compositor_host_window_, SW_HIDE); 1353 ::ShowWindow(compositor_host_window_, SW_HIDE);
1348 hide_compositor_window_at_next_paint_ = false; 1354 hide_compositor_window_at_next_paint_ = false;
1349 } 1355 }
1350 1356
1351 CPaintDC paint_dc(m_hWnd);
1352
1353 gfx::Rect damaged_rect(paint_dc.m_ps.rcPaint); 1357 gfx::Rect damaged_rect(paint_dc.m_ps.rcPaint);
1354 if (damaged_rect.IsEmpty()) 1358 if (damaged_rect.IsEmpty())
1355 return; 1359 return;
1356 1360
1357 if (accelerated_surface_.get() &&
1358 render_widget_host_->is_accelerated_compositing_active()) {
1359 AcceleratedPaint(paint_dc.m_hDC);
1360 return;
1361 }
1362
1363 if (backing_store) { 1361 if (backing_store) {
1364 gfx::Rect bitmap_rect(gfx::Point(), backing_store->size()); 1362 gfx::Rect bitmap_rect(gfx::Point(), backing_store->size());
1365 1363
1366 bool manage_colors = BackingStoreWin::ColorManagementEnabled(); 1364 bool manage_colors = BackingStoreWin::ColorManagementEnabled();
1367 if (manage_colors) 1365 if (manage_colors)
1368 SetICMMode(paint_dc.m_hDC, ICM_ON); 1366 SetICMMode(paint_dc.m_hDC, ICM_ON);
1369 1367
1370 // Blit only the damaged regions from the backing store. 1368 // Blit only the damaged regions from the backing store.
1371 DWORD data_size = GetRegionData(damage_region, 0, NULL); 1369 DWORD data_size = GetRegionData(damage_region, 0, NULL);
1372 scoped_array<char> region_data_buf; 1370 scoped_array<char> region_data_buf;
(...skipping 1722 matching lines...) Expand 10 before | Expand all | Expand 10 after
3095 // receive a focus change in the context of a pointer down message, it means 3093 // receive a focus change in the context of a pointer down message, it means
3096 // that the pointer down message occurred on the edit field and we should 3094 // that the pointer down message occurred on the edit field and we should
3097 // display the on screen keyboard 3095 // display the on screen keyboard
3098 if (!received_focus_change_after_pointer_down_ && virtual_keyboard_) 3096 if (!received_focus_change_after_pointer_down_ && virtual_keyboard_)
3099 DisplayOnScreenKeyboardIfNeeded(); 3097 DisplayOnScreenKeyboardIfNeeded();
3100 received_focus_change_after_pointer_down_ = false; 3098 received_focus_change_after_pointer_down_ = false;
3101 pointer_down_context_ = false; 3099 pointer_down_context_ = false;
3102 } 3100 }
3103 3101
3104 } // namespace content 3102 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698