| 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_view_android.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_android.h" |
| 6 | 6 |
| 7 #include <android/bitmap.h> | 7 #include <android/bitmap.h> |
| 8 | 8 |
| 9 #include "base/android/build_info.h" | 9 #include "base/android/build_info.h" |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 ReadbackRequest& readback_request = readbacks_waiting_for_frame_.front(); | 382 ReadbackRequest& readback_request = readbacks_waiting_for_frame_.front(); |
| 383 readback_request.GetResultCallback().Run(false, SkBitmap()); | 383 readback_request.GetResultCallback().Run(false, SkBitmap()); |
| 384 readbacks_waiting_for_frame_.pop(); | 384 readbacks_waiting_for_frame_.pop(); |
| 385 } | 385 } |
| 386 } | 386 } |
| 387 | 387 |
| 388 void RenderWidgetHostViewAndroid::GetScaledContentBitmap( | 388 void RenderWidgetHostViewAndroid::GetScaledContentBitmap( |
| 389 float scale, | 389 float scale, |
| 390 SkColorType color_type, | 390 SkColorType color_type, |
| 391 gfx::Rect src_subrect, | 391 gfx::Rect src_subrect, |
| 392 const base::Callback<void(bool, const SkBitmap&)>& result_callback) { | 392 CopyFromCompositingSurfaceCallback& result_callback) { |
| 393 if (!host_ || host_->is_hidden()) { | 393 if (!host_ || host_->is_hidden()) { |
| 394 result_callback.Run(false, SkBitmap()); | 394 result_callback.Run(false, SkBitmap()); |
| 395 return; | 395 return; |
| 396 } | 396 } |
| 397 if (!IsSurfaceAvailableForCopy()) { | 397 if (!IsSurfaceAvailableForCopy()) { |
| 398 // The view is visible, probably the frame has not yet arrived. | 398 // The view is visible, probably the frame has not yet arrived. |
| 399 // Just add the ReadbackRequest to queue and wait for frame arrival | 399 // Just add the ReadbackRequest to queue and wait for frame arrival |
| 400 // to get this request processed. | 400 // to get this request processed. |
| 401 readbacks_waiting_for_frame_.push( | 401 readbacks_waiting_for_frame_.push( |
| 402 ReadbackRequest(scale, color_type, src_subrect, result_callback)); | 402 ReadbackRequest(scale, color_type, src_subrect, result_callback)); |
| (...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 844 } | 844 } |
| 845 | 845 |
| 846 void RenderWidgetHostViewAndroid::SetBackgroundOpaque(bool opaque) { | 846 void RenderWidgetHostViewAndroid::SetBackgroundOpaque(bool opaque) { |
| 847 RenderWidgetHostViewBase::SetBackgroundOpaque(opaque); | 847 RenderWidgetHostViewBase::SetBackgroundOpaque(opaque); |
| 848 host_->SetBackgroundOpaque(opaque); | 848 host_->SetBackgroundOpaque(opaque); |
| 849 } | 849 } |
| 850 | 850 |
| 851 void RenderWidgetHostViewAndroid::CopyFromCompositingSurface( | 851 void RenderWidgetHostViewAndroid::CopyFromCompositingSurface( |
| 852 const gfx::Rect& src_subrect, | 852 const gfx::Rect& src_subrect, |
| 853 const gfx::Size& dst_size, | 853 const gfx::Size& dst_size, |
| 854 const base::Callback<void(bool, const SkBitmap&)>& callback, | 854 CopyFromCompositingSurfaceCallback& callback, |
| 855 const SkColorType color_type) { | 855 const SkColorType color_type) { |
| 856 TRACE_EVENT0("cc", "RenderWidgetHostViewAndroid::CopyFromCompositingSurface"); | 856 TRACE_EVENT0("cc", "RenderWidgetHostViewAndroid::CopyFromCompositingSurface"); |
| 857 if ((!host_ || host_->is_hidden()) || | 857 if ((!host_ || host_->is_hidden()) || |
| 858 !IsReadbackConfigSupported(color_type)) { | 858 !IsReadbackConfigSupported(color_type)) { |
| 859 callback.Run(false, SkBitmap()); | 859 callback.Run(false, SkBitmap()); |
| 860 return; | 860 return; |
| 861 } | 861 } |
| 862 base::TimeTicks start_time = base::TimeTicks::Now(); | 862 base::TimeTicks start_time = base::TimeTicks::Now(); |
| 863 if (!using_synchronous_compositor_ && !IsSurfaceAvailableForCopy()) { | 863 if (!using_synchronous_compositor_ && !IsSurfaceAvailableForCopy()) { |
| 864 callback.Run(false, SkBitmap()); | 864 callback.Run(false, SkBitmap()); |
| (...skipping 1002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1867 results->orientationAngle = display.RotationAsDegree(); | 1867 results->orientationAngle = display.RotationAsDegree(); |
| 1868 results->orientationType = | 1868 results->orientationType = |
| 1869 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); | 1869 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); |
| 1870 gfx::DeviceDisplayInfo info; | 1870 gfx::DeviceDisplayInfo info; |
| 1871 results->depth = info.GetBitsPerPixel(); | 1871 results->depth = info.GetBitsPerPixel(); |
| 1872 results->depthPerComponent = info.GetBitsPerComponent(); | 1872 results->depthPerComponent = info.GetBitsPerComponent(); |
| 1873 results->isMonochrome = (results->depthPerComponent == 0); | 1873 results->isMonochrome = (results->depthPerComponent == 0); |
| 1874 } | 1874 } |
| 1875 | 1875 |
| 1876 } // namespace content | 1876 } // namespace content |
| OLD | NEW |