| 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 <math.h> | 7 #include <math.h> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 740 "RenderWidgetHostImpl::CopyFromBackingStore::FromBackingStore"); | 740 "RenderWidgetHostImpl::CopyFromBackingStore::FromBackingStore"); |
| 741 gfx::Rect copy_rect = src_subrect.IsEmpty() ? | 741 gfx::Rect copy_rect = src_subrect.IsEmpty() ? |
| 742 gfx::Rect(backing_store->size()) : src_subrect; | 742 gfx::Rect(backing_store->size()) : src_subrect; |
| 743 // When the result size is equal to the backing store size, copy from the | 743 // When the result size is equal to the backing store size, copy from the |
| 744 // backing store directly to the output canvas. | 744 // backing store directly to the output canvas. |
| 745 skia::PlatformBitmap output; | 745 skia::PlatformBitmap output; |
| 746 bool result = backing_store->CopyFromBackingStore(copy_rect, &output); | 746 bool result = backing_store->CopyFromBackingStore(copy_rect, &output); |
| 747 callback.Run(result, output.GetBitmap()); | 747 callback.Run(result, output.GetBitmap()); |
| 748 } | 748 } |
| 749 | 749 |
| 750 bool RenderWidgetHostImpl::CanCopyFromBackingStore() { |
| 751 if (view_) |
| 752 return view_->IsSurfaceAvailableForCopy(); |
| 753 return false; |
| 754 } |
| 755 |
| 756 void RenderWidgetHostImpl::LockForCopyFromBackingStore() { |
| 757 if (view_) |
| 758 view_->LockSurfaceForCopy(); |
| 759 } |
| 760 |
| 761 void RenderWidgetHostImpl::UnlockForCopyFromBackingStore() { |
| 762 if (view_) |
| 763 view_->UnlockSurfaceForCopy(); |
| 764 } |
| 765 |
| 750 #if defined(TOOLKIT_GTK) | 766 #if defined(TOOLKIT_GTK) |
| 751 bool RenderWidgetHostImpl::CopyFromBackingStoreToGtkWindow( | 767 bool RenderWidgetHostImpl::CopyFromBackingStoreToGtkWindow( |
| 752 const gfx::Rect& dest_rect, GdkWindow* target) { | 768 const gfx::Rect& dest_rect, GdkWindow* target) { |
| 753 BackingStore* backing_store = GetBackingStore(false); | 769 BackingStore* backing_store = GetBackingStore(false); |
| 754 if (!backing_store) | 770 if (!backing_store) |
| 755 return false; | 771 return false; |
| 756 (static_cast<BackingStoreGtk*>(backing_store))->PaintToRect( | 772 (static_cast<BackingStoreGtk*>(backing_store))->PaintToRect( |
| 757 dest_rect, target); | 773 dest_rect, target); |
| 758 return true; | 774 return true; |
| 759 } | 775 } |
| (...skipping 1768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2528 } | 2544 } |
| 2529 } | 2545 } |
| 2530 | 2546 |
| 2531 // Add newly generated components into the latency info | 2547 // Add newly generated components into the latency info |
| 2532 for (lc = new_components.begin(); lc != new_components.end(); ++lc) { | 2548 for (lc = new_components.begin(); lc != new_components.end(); ++lc) { |
| 2533 latency_info->latency_components[lc->first] = lc->second; | 2549 latency_info->latency_components[lc->first] = lc->second; |
| 2534 } | 2550 } |
| 2535 } | 2551 } |
| 2536 | 2552 |
| 2537 } // namespace content | 2553 } // namespace content |
| OLD | NEW |