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

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

Issue 6296010: Don't unnecessarily paint pixles when doing optimized always-on-top pepper pa... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 11 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) 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 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 // painting, because that avoids copying the plugin image to a different 434 // painting, because that avoids copying the plugin image to a different
435 // paint rect. Unfortunately, if anything on the page is animating other 435 // paint rect. Unfortunately, if anything on the page is animating other
436 // than the movie, it break this optimization since the union of the 436 // than the movie, it break this optimization since the union of the
437 // invalid regions will be larger than the plugin. 437 // invalid regions will be larger than the plugin.
438 // 438 //
439 // This code optimizes that case, where we can still avoid painting in 439 // This code optimizes that case, where we can still avoid painting in
440 // WebKit and filling the background (which can be slow) and just painting 440 // WebKit and filling the background (which can be slow) and just painting
441 // the plugin. Unlike the DoDeferredUpdate case, an extra copy is still 441 // the plugin. Unlike the DoDeferredUpdate case, an extra copy is still
442 // required. 442 // required.
443 optimized_instance->Paint(webkit_glue::ToWebCanvas(canvas), 443 optimized_instance->Paint(webkit_glue::ToWebCanvas(canvas),
444 optimized_copy_location, optimized_copy_location); 444 optimized_copy_location, rect);
445 } else { 445 } else {
446 // Normal painting case. 446 // Normal painting case.
447 webwidget_->paint(webkit_glue::ToWebCanvas(canvas), rect); 447 webwidget_->paint(webkit_glue::ToWebCanvas(canvas), rect);
448 448
449 // Flush to underlying bitmap. TODO(darin): is this needed? 449 // Flush to underlying bitmap. TODO(darin): is this needed?
450 canvas->getTopPlatformDevice().accessBitmap(false); 450 canvas->getTopPlatformDevice().accessBitmap(false);
451 } 451 }
452 452
453 PaintDebugBorder(rect, canvas); 453 PaintDebugBorder(rect, canvas);
454 canvas->restore(); 454 canvas->restore();
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 // within the plugin. There is a related optimization in PaintRect for the 523 // within the plugin. There is a related optimization in PaintRect for the
524 // case where there may be multiple invalid regions. 524 // case where there may be multiple invalid regions.
525 TransportDIB::Id dib_id = TransportDIB::Id(); 525 TransportDIB::Id dib_id = TransportDIB::Id();
526 TransportDIB* dib = NULL; 526 TransportDIB* dib = NULL;
527 std::vector<gfx::Rect> copy_rects; 527 std::vector<gfx::Rect> copy_rects;
528 gfx::Rect optimized_copy_rect, optimized_copy_location; 528 gfx::Rect optimized_copy_rect, optimized_copy_location;
529 if (update.scroll_rect.IsEmpty() && 529 if (update.scroll_rect.IsEmpty() &&
530 !is_accelerated_compositing_active_ && 530 !is_accelerated_compositing_active_ &&
531 GetBitmapForOptimizedPluginPaint(bounds, &dib, &optimized_copy_location, 531 GetBitmapForOptimizedPluginPaint(bounds, &dib, &optimized_copy_location,
532 &optimized_copy_rect)) { 532 &optimized_copy_rect)) {
533 // Only update the part of the plugin that actually changed.
534 optimized_copy_rect = optimized_copy_rect.Intersect(bounds);
533 bounds = optimized_copy_location; 535 bounds = optimized_copy_location;
534 copy_rects.push_back(optimized_copy_rect); 536 copy_rects.push_back(optimized_copy_rect);
535 dib_id = dib->id(); 537 dib_id = dib->id();
536 } else if (!is_accelerated_compositing_active_) { 538 } else if (!is_accelerated_compositing_active_) {
537 // Compute a buffer for painting and cache it. 539 // Compute a buffer for painting and cache it.
538 scoped_ptr<skia::PlatformCanvas> canvas( 540 scoped_ptr<skia::PlatformCanvas> canvas(
539 RenderProcess::current()->GetDrawingCanvas(&current_paint_buf_, 541 RenderProcess::current()->GetDrawingCanvas(&current_paint_buf_,
540 bounds)); 542 bounds));
541 if (!canvas.get()) { 543 if (!canvas.get()) {
542 NOTREACHED(); 544 NOTREACHED();
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
1021 1023
1022 void RenderWidget::CleanupWindowInPluginMoves(gfx::PluginWindowHandle window) { 1024 void RenderWidget::CleanupWindowInPluginMoves(gfx::PluginWindowHandle window) {
1023 for (WebPluginGeometryVector::iterator i = plugin_window_moves_.begin(); 1025 for (WebPluginGeometryVector::iterator i = plugin_window_moves_.begin();
1024 i != plugin_window_moves_.end(); ++i) { 1026 i != plugin_window_moves_.end(); ++i) {
1025 if (i->window == window) { 1027 if (i->window == window) {
1026 plugin_window_moves_.erase(i); 1028 plugin_window_moves_.erase(i);
1027 break; 1029 break;
1028 } 1030 }
1029 } 1031 }
1030 } 1032 }
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