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 724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
735 "RenderWidgetHostImpl::CopyFromBackingStore::FromBackingStore"); | 735 "RenderWidgetHostImpl::CopyFromBackingStore::FromBackingStore"); |
736 gfx::Rect copy_rect = src_subrect.IsEmpty() ? | 736 gfx::Rect copy_rect = src_subrect.IsEmpty() ? |
737 gfx::Rect(backing_store->size()) : src_subrect; | 737 gfx::Rect(backing_store->size()) : src_subrect; |
738 // When the result size is equal to the backing store size, copy from the | 738 // When the result size is equal to the backing store size, copy from the |
739 // backing store directly to the output canvas. | 739 // backing store directly to the output canvas. |
740 skia::PlatformBitmap output; | 740 skia::PlatformBitmap output; |
741 bool result = backing_store->CopyFromBackingStore(copy_rect, &output); | 741 bool result = backing_store->CopyFromBackingStore(copy_rect, &output); |
742 callback.Run(result, output.GetBitmap()); | 742 callback.Run(result, output.GetBitmap()); |
743 } | 743 } |
744 | 744 |
| 745 bool RenderWidgetHostImpl::CanCopyFromBackingStore() { |
| 746 if (view_) |
| 747 return view_->IsSurfaceAvailableForCopy(); |
| 748 return false; |
| 749 } |
| 750 |
| 751 #if defined(OS_ANDROID) |
| 752 void RenderWidgetHostImpl::LockBackingStore() { |
| 753 if (view_) |
| 754 view_->LockCompositingSurface(); |
| 755 } |
| 756 |
| 757 void RenderWidgetHostImpl::UnlockBackingStore() { |
| 758 if (view_) |
| 759 view_->UnlockCompositingSurface(); |
| 760 } |
| 761 #endif |
| 762 |
745 #if defined(TOOLKIT_GTK) | 763 #if defined(TOOLKIT_GTK) |
746 bool RenderWidgetHostImpl::CopyFromBackingStoreToGtkWindow( | 764 bool RenderWidgetHostImpl::CopyFromBackingStoreToGtkWindow( |
747 const gfx::Rect& dest_rect, GdkWindow* target) { | 765 const gfx::Rect& dest_rect, GdkWindow* target) { |
748 BackingStore* backing_store = GetBackingStore(false); | 766 BackingStore* backing_store = GetBackingStore(false); |
749 if (!backing_store) | 767 if (!backing_store) |
750 return false; | 768 return false; |
751 (static_cast<BackingStoreGtk*>(backing_store))->PaintToRect( | 769 (static_cast<BackingStoreGtk*>(backing_store))->PaintToRect( |
752 dest_rect, target); | 770 dest_rect, target); |
753 return true; | 771 return true; |
754 } | 772 } |
(...skipping 1771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2526 } | 2544 } |
2527 } | 2545 } |
2528 | 2546 |
2529 SkBitmap::Config RenderWidgetHostImpl::PreferredReadbackFormat() { | 2547 SkBitmap::Config RenderWidgetHostImpl::PreferredReadbackFormat() { |
2530 if (view_) | 2548 if (view_) |
2531 return view_->PreferredReadbackFormat(); | 2549 return view_->PreferredReadbackFormat(); |
2532 return SkBitmap::kARGB_8888_Config; | 2550 return SkBitmap::kARGB_8888_Config; |
2533 } | 2551 } |
2534 | 2552 |
2535 } // namespace content | 2553 } // namespace content |
OLD | NEW |