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

Side by Side Diff: chrome/renderer/render_widget.cc

Issue 5613002: Allow painting multiple paint rects.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "chrome/renderer/render_widget.h" 5 #include "chrome/renderer/render_widget.h"
6 6
7 #include "app/surface/transport_dib.h" 7 #include "app/surface/transport_dib.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 return; 460 return;
461 } 461 }
462 462
463 // Layout may generate more invalidation. It may also enable the 463 // Layout may generate more invalidation. It may also enable the
464 // GPU acceleration, so make sure to run layout before we send the 464 // GPU acceleration, so make sure to run layout before we send the
465 // GpuRenderingActivated message. 465 // GpuRenderingActivated message.
466 webwidget_->layout(); 466 webwidget_->layout();
467 467
468 // OK, save the pending update to a local since painting may cause more 468 // OK, save the pending update to a local since painting may cause more
469 // invalidation. Some WebCore rendering objects only layout when painted. 469 // invalidation. Some WebCore rendering objects only layout when painted.
470 PaintAggregator::PendingUpdate update = paint_aggregator_.GetPendingUpdate(); 470 PaintAggregator::PendingUpdate update;
471 paint_aggregator_.ClearPendingUpdate(); 471 paint_aggregator_.PopPendingUpdate(&update);
472 472
473 gfx::Rect scroll_damage = update.GetScrollDamage(); 473 gfx::Rect scroll_damage = update.GetScrollDamage();
474 gfx::Rect bounds = update.GetPaintBounds().Union(scroll_damage); 474 gfx::Rect bounds = update.GetPaintBounds().Union(scroll_damage);
475 475
476 // A plugin may be able to do an optimized paint. First check this, in which 476 // A plugin may be able to do an optimized paint. First check this, in which
477 // case we can skip all of the bitmap generation and regular paint code. 477 // case we can skip all of the bitmap generation and regular paint code.
478 TransportDIB::Id dib_id = TransportDIB::Id(); 478 TransportDIB::Id dib_id = TransportDIB::Id();
479 TransportDIB* dib = NULL; 479 TransportDIB* dib = NULL;
480 std::vector<gfx::Rect> copy_rects; 480 std::vector<gfx::Rect> copy_rects;
481 gfx::Rect optimized_copy_rect, optimized_copy_location; 481 gfx::Rect optimized_copy_rect, optimized_copy_location;
(...skipping 16 matching lines...) Expand all
498 498
499 // We may get back a smaller canvas than we asked for. 499 // We may get back a smaller canvas than we asked for.
500 // TODO(darin): This seems like it could cause painting problems! 500 // TODO(darin): This seems like it could cause painting problems!
501 DCHECK_EQ(bounds.width(), canvas->getDevice()->width()); 501 DCHECK_EQ(bounds.width(), canvas->getDevice()->width());
502 DCHECK_EQ(bounds.height(), canvas->getDevice()->height()); 502 DCHECK_EQ(bounds.height(), canvas->getDevice()->height());
503 bounds.set_width(canvas->getDevice()->width()); 503 bounds.set_width(canvas->getDevice()->width());
504 bounds.set_height(canvas->getDevice()->height()); 504 bounds.set_height(canvas->getDevice()->height());
505 505
506 HISTOGRAM_COUNTS_100("MPArch.RW_PaintRectCount", update.paint_rects.size()); 506 HISTOGRAM_COUNTS_100("MPArch.RW_PaintRectCount", update.paint_rects.size());
507 507
508 // TODO(darin): Re-enable painting multiple damage rects once the
509 // page-cycler regressions are resolved. See bug 29589.
510 if (update.scroll_rect.IsEmpty()) {
511 update.paint_rects.clear();
512 update.paint_rects.push_back(bounds);
513 }
514
515 // The scroll damage is just another rectangle to paint and copy. 508 // The scroll damage is just another rectangle to paint and copy.
516 copy_rects.swap(update.paint_rects); 509 copy_rects.swap(update.paint_rects);
517 if (!scroll_damage.IsEmpty()) 510 if (!scroll_damage.IsEmpty())
518 copy_rects.push_back(scroll_damage); 511 copy_rects.push_back(scroll_damage);
519 512
520 for (size_t i = 0; i < copy_rects.size(); ++i) 513 for (size_t i = 0; i < copy_rects.size(); ++i)
521 PaintRect(copy_rects[i], bounds.origin(), canvas.get()); 514 PaintRect(copy_rects[i], bounds.origin(), canvas.get());
522 515
523 dib_id = current_paint_buf_->id(); 516 dib_id = current_paint_buf_->id();
524 } else { // Accelerated compositing path 517 } else { // Accelerated compositing path
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
981 974
982 void RenderWidget::CleanupWindowInPluginMoves(gfx::PluginWindowHandle window) { 975 void RenderWidget::CleanupWindowInPluginMoves(gfx::PluginWindowHandle window) {
983 for (WebPluginGeometryVector::iterator i = plugin_window_moves_.begin(); 976 for (WebPluginGeometryVector::iterator i = plugin_window_moves_.begin();
984 i != plugin_window_moves_.end(); ++i) { 977 i != plugin_window_moves_.end(); ++i) {
985 if (i->window == window) { 978 if (i->window == window) {
986 plugin_window_moves_.erase(i); 979 plugin_window_moves_.erase(i);
987 break; 980 break;
988 } 981 }
989 } 982 }
990 } 983 }
OLDNEW
« chrome/renderer/paint_aggregator.h ('K') | « chrome/renderer/paint_aggregator_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698