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

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

Issue 10815070: Support copying a partial rectangle region from the compositing surface on Aura and GTK. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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
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_impl.h" 5 #include "content/browser/renderer_host/render_widget_host_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 } 489 }
490 490
491 void RenderWidgetHostImpl::SetIsLoading(bool is_loading) { 491 void RenderWidgetHostImpl::SetIsLoading(bool is_loading) {
492 is_loading_ = is_loading; 492 is_loading_ = is_loading;
493 if (!view_) 493 if (!view_)
494 return; 494 return;
495 view_->SetIsLoading(is_loading); 495 view_->SetIsLoading(is_loading);
496 } 496 }
497 497
498 void RenderWidgetHostImpl::CopyFromBackingStore( 498 void RenderWidgetHostImpl::CopyFromBackingStore(
499 const gfx::Rect& src_rect, 499 const gfx::Rect& src_subrect,
500 const gfx::Size& accelerated_dest_size, 500 const gfx::Size& accelerated_dst_size,
501 const base::Callback<void(bool)>& callback, 501 const base::Callback<void(bool)>& callback,
502 skia::PlatformCanvas* output) { 502 skia::PlatformCanvas* output) {
503 if (view_ && is_accelerated_compositing_active_) { 503 if (view_ && is_accelerated_compositing_active_) {
504 TRACE_EVENT0("browser", 504 TRACE_EVENT0("browser",
505 "RenderWidgetHostImpl::CopyFromBackingStore::FromCompositingSurface"); 505 "RenderWidgetHostImpl::CopyFromBackingStore::FromCompositingSurface");
506 // TODO(mazda): Support partial copy with |src_rect| 506 gfx::Rect copy_rect = src_subrect.IsEmpty() ?
507 // (http://crbug.com/118571). 507 gfx::Rect(view_->GetViewBounds().size()) : src_subrect;
508 view_->CopyFromCompositingSurface(accelerated_dest_size, 508 view_->CopyFromCompositingSurface(copy_rect,
509 accelerated_dst_size,
509 callback, 510 callback,
510 output); 511 output);
511 return; 512 return;
512 } 513 }
513 514
514 BackingStore* backing_store = GetBackingStore(false); 515 BackingStore* backing_store = GetBackingStore(false);
515 if (!backing_store) { 516 if (!backing_store) {
516 callback.Run(false); 517 callback.Run(false);
517 return; 518 return;
518 } 519 }
519 520
520 TRACE_EVENT0("browser", 521 TRACE_EVENT0("browser",
521 "RenderWidgetHostImpl::CopyFromBackingStore::FromBackingStore"); 522 "RenderWidgetHostImpl::CopyFromBackingStore::FromBackingStore");
522 const gfx::Size backing_store_size = backing_store->size(); 523 gfx::Rect copy_rect = src_subrect.IsEmpty() ?
523 gfx::Rect copy_rect = src_rect.IsEmpty() ? 524 gfx::Rect(backing_store->size()) : src_subrect;
524 gfx::Rect(0, 0, backing_store_size.width(), backing_store_size.height()) :
525 src_rect;
526 // When the result size is equal to the backing store size, copy from the 525 // When the result size is equal to the backing store size, copy from the
527 // backing store directly to the output canvas. 526 // backing store directly to the output canvas.
528 bool result = backing_store->CopyFromBackingStore(copy_rect, output); 527 bool result = backing_store->CopyFromBackingStore(copy_rect, output);
529 callback.Run(result); 528 callback.Run(result);
530 } 529 }
531 530
532 #if defined(TOOLKIT_GTK) 531 #if defined(TOOLKIT_GTK)
533 bool RenderWidgetHostImpl::CopyFromBackingStoreToGtkWindow( 532 bool RenderWidgetHostImpl::CopyFromBackingStoreToGtkWindow(
534 const gfx::Rect& dest_rect, GdkWindow* target) { 533 const gfx::Rect& dest_rect, GdkWindow* target) {
535 BackingStore* backing_store = GetBackingStore(false); 534 BackingStore* backing_store = GetBackingStore(false);
(...skipping 1384 matching lines...) Expand 10 before | Expand all | Expand 10 after
1920 // indicate that no callback is in progress (i.e. without this line 1919 // indicate that no callback is in progress (i.e. without this line
1921 // DelayedAutoResized will not get called again). 1920 // DelayedAutoResized will not get called again).
1922 new_auto_size_.SetSize(0, 0); 1921 new_auto_size_.SetSize(0, 0);
1923 if (!should_auto_resize_) 1922 if (!should_auto_resize_)
1924 return; 1923 return;
1925 1924
1926 OnRenderAutoResized(new_size); 1925 OnRenderAutoResized(new_size);
1927 } 1926 }
1928 1927
1929 } // namespace content 1928 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698