| OLD | NEW |
| 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 Loading... |
| 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 #if defined(USE_AURA) || defined(LINUX) |
| 507 // (http://crbug.com/118571). | 507 gfx::Rect copy_rect = src_subrect.IsEmpty() ? |
| 508 view_->CopyFromCompositingSurface(accelerated_dest_size, | 508 gfx::Rect(view_->GetViewBounds().size()) : src_subrect; |
| 509 #else |
| 510 // Just passes an empty rect to CopyFromCompositingSurface on non-Aura Win |
| 511 // and Mac because copying a partial rectangle is not supported. |
| 512 gfx::Rect copy_rect; |
| 513 #endif |
| 514 view_->CopyFromCompositingSurface(copy_rect, |
| 515 accelerated_dst_size, |
| 509 callback, | 516 callback, |
| 510 output); | 517 output); |
| 511 return; | 518 return; |
| 512 } | 519 } |
| 513 | 520 |
| 514 BackingStore* backing_store = GetBackingStore(false); | 521 BackingStore* backing_store = GetBackingStore(false); |
| 515 if (!backing_store) { | 522 if (!backing_store) { |
| 516 callback.Run(false); | 523 callback.Run(false); |
| 517 return; | 524 return; |
| 518 } | 525 } |
| 519 | 526 |
| 520 TRACE_EVENT0("browser", | 527 TRACE_EVENT0("browser", |
| 521 "RenderWidgetHostImpl::CopyFromBackingStore::FromBackingStore"); | 528 "RenderWidgetHostImpl::CopyFromBackingStore::FromBackingStore"); |
| 522 const gfx::Size backing_store_size = backing_store->size(); | 529 gfx::Rect copy_rect = src_subrect.IsEmpty() ? |
| 523 gfx::Rect copy_rect = src_rect.IsEmpty() ? | 530 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 | 531 // When the result size is equal to the backing store size, copy from the |
| 527 // backing store directly to the output canvas. | 532 // backing store directly to the output canvas. |
| 528 bool result = backing_store->CopyFromBackingStore(copy_rect, output); | 533 bool result = backing_store->CopyFromBackingStore(copy_rect, output); |
| 529 callback.Run(result); | 534 callback.Run(result); |
| 530 } | 535 } |
| 531 | 536 |
| 532 #if defined(TOOLKIT_GTK) | 537 #if defined(TOOLKIT_GTK) |
| 533 bool RenderWidgetHostImpl::CopyFromBackingStoreToGtkWindow( | 538 bool RenderWidgetHostImpl::CopyFromBackingStoreToGtkWindow( |
| 534 const gfx::Rect& dest_rect, GdkWindow* target) { | 539 const gfx::Rect& dest_rect, GdkWindow* target) { |
| 535 BackingStore* backing_store = GetBackingStore(false); | 540 BackingStore* backing_store = GetBackingStore(false); |
| (...skipping 1384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1920 // indicate that no callback is in progress (i.e. without this line | 1925 // indicate that no callback is in progress (i.e. without this line |
| 1921 // DelayedAutoResized will not get called again). | 1926 // DelayedAutoResized will not get called again). |
| 1922 new_auto_size_.SetSize(0, 0); | 1927 new_auto_size_.SetSize(0, 0); |
| 1923 if (!should_auto_resize_) | 1928 if (!should_auto_resize_) |
| 1924 return; | 1929 return; |
| 1925 | 1930 |
| 1926 OnRenderAutoResized(new_size); | 1931 OnRenderAutoResized(new_size); |
| 1927 } | 1932 } |
| 1928 | 1933 |
| 1929 } // namespace content | 1934 } // namespace content |
| OLD | NEW |