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 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
668 RejectMouseLockOrUnlockIfNecessary(); | 668 RejectMouseLockOrUnlockIfNecessary(); |
669 | 669 |
670 // TODO(evanm): tracking this may no longer be necessary; | 670 // TODO(evanm): tracking this may no longer be necessary; |
671 // eliminate this function if so. | 671 // eliminate this function if so. |
672 SetView(NULL); | 672 SetView(NULL); |
673 } | 673 } |
674 | 674 |
675 void RenderWidgetHostImpl::CopyFromBackingStore( | 675 void RenderWidgetHostImpl::CopyFromBackingStore( |
676 const gfx::Rect& src_subrect, | 676 const gfx::Rect& src_subrect, |
677 const gfx::Size& accelerated_dst_size, | 677 const gfx::Size& accelerated_dst_size, |
678 const base::Callback<void(bool, const SkBitmap&)>& callback, | 678 ReadbackRequestCallback& callback, |
679 const SkColorType color_type) { | 679 const SkColorType color_type) { |
680 if (view_) { | 680 if (view_) { |
681 TRACE_EVENT0("browser", | 681 TRACE_EVENT0("browser", |
682 "RenderWidgetHostImpl::CopyFromBackingStore::FromCompositingSurface"); | 682 "RenderWidgetHostImpl::CopyFromBackingStore::FromCompositingSurface"); |
683 gfx::Rect accelerated_copy_rect = src_subrect.IsEmpty() ? | 683 gfx::Rect accelerated_copy_rect = src_subrect.IsEmpty() ? |
684 gfx::Rect(view_->GetViewBounds().size()) : src_subrect; | 684 gfx::Rect(view_->GetViewBounds().size()) : src_subrect; |
685 view_->CopyFromCompositingSurface( | 685 view_->CopyFromCompositingSurface( |
686 accelerated_copy_rect, accelerated_dst_size, callback, color_type); | 686 accelerated_copy_rect, accelerated_dst_size, callback, color_type); |
687 return; | 687 return; |
688 } | 688 } |
689 | 689 |
690 callback.Run(false, SkBitmap()); | 690 callback.Run(SkBitmap(), content::READBACK_FAILED); |
691 } | 691 } |
692 | 692 |
693 bool RenderWidgetHostImpl::CanCopyFromBackingStore() { | 693 bool RenderWidgetHostImpl::CanCopyFromBackingStore() { |
694 if (view_) | 694 if (view_) |
695 return view_->IsSurfaceAvailableForCopy(); | 695 return view_->IsSurfaceAvailableForCopy(); |
696 return false; | 696 return false; |
697 } | 697 } |
698 | 698 |
699 #if defined(OS_ANDROID) | 699 #if defined(OS_ANDROID) |
700 void RenderWidgetHostImpl::LockBackingStore() { | 700 void RenderWidgetHostImpl::LockBackingStore() { |
(...skipping 1720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2421 } | 2421 } |
2422 #endif | 2422 #endif |
2423 | 2423 |
2424 SkColorType RenderWidgetHostImpl::PreferredReadbackFormat() { | 2424 SkColorType RenderWidgetHostImpl::PreferredReadbackFormat() { |
2425 if (view_) | 2425 if (view_) |
2426 return view_->PreferredReadbackFormat(); | 2426 return view_->PreferredReadbackFormat(); |
2427 return kN32_SkColorType; | 2427 return kN32_SkColorType; |
2428 } | 2428 } |
2429 | 2429 |
2430 } // namespace content | 2430 } // namespace content |
OLD | NEW |