Index: content/browser/renderer_host/render_widget_host_view_android.cc |
diff --git a/content/browser/renderer_host/render_widget_host_view_android.cc b/content/browser/renderer_host/render_widget_host_view_android.cc |
index dba444dff70b19c755109494fa7471bcc80f3263..fdc7810375eb907c8fe2b6decebddd50447fc996 100644 |
--- a/content/browser/renderer_host/render_widget_host_view_android.cc |
+++ b/content/browser/renderer_host/render_widget_host_view_android.cc |
@@ -593,11 +593,7 @@ void RenderWidgetHostViewAndroid::CopyFromCompositingSurface( |
const gfx::Size& dst_size, |
const base::Callback<void(bool, const SkBitmap&)>& callback, |
const SkBitmap::Config bitmap_config) { |
- // Only ARGB888 and RGB565 supported as of now. |
- bool format_support = ((bitmap_config == SkBitmap::kRGB_565_Config) || |
- (bitmap_config == SkBitmap::kARGB_8888_Config)); |
- if (!format_support) { |
- DCHECK(format_support); |
+ if (!IsReadbackConfigSupported(bitmap_config)) { |
callback.Run(false, SkBitmap()); |
return; |
} |
@@ -606,18 +602,6 @@ void RenderWidgetHostViewAndroid::CopyFromCompositingSurface( |
callback.Run(false, SkBitmap()); |
return; |
} |
- ImageTransportFactoryAndroid* factory = |
- ImageTransportFactoryAndroid::GetInstance(); |
- GLHelper* gl_helper = factory->GetGLHelper(); |
- if (!gl_helper) |
- return; |
- bool check_rgb565_support = gl_helper->CanUseRgb565Readback(); |
- if ((bitmap_config == SkBitmap::kRGB_565_Config) && |
- !check_rgb565_support) { |
- LOG(ERROR) << "Readbackformat rgb565 not supported"; |
- callback.Run(false, SkBitmap()); |
- return; |
- } |
const gfx::Display& display = |
gfx::Screen::GetNativeScreen()->GetPrimaryDisplay(); |
float device_scale_factor = display.device_scale_factor(); |
@@ -1325,6 +1309,7 @@ void RenderWidgetHostViewAndroid::PrepareTextureCopyOutputResult( |
ImageTransportFactoryAndroid* factory = |
ImageTransportFactoryAndroid::GetInstance(); |
GLHelper* gl_helper = factory->GetGLHelper(); |
+ |
if (!gl_helper) |
return; |
@@ -1391,6 +1376,16 @@ void RenderWidgetHostViewAndroid::PrepareBitmapCopyOutputResult( |
callback.Run(true, *source); |
} |
+bool RenderWidgetHostViewAndroid::IsReadbackConfigSupported( |
+ SkBitmap::Config bitmap_config) { |
+ ImageTransportFactoryAndroid* factory = |
+ ImageTransportFactoryAndroid::GetInstance(); |
+ GLHelper* gl_helper = factory->GetGLHelper(); |
+ if (!gl_helper) |
+ return false; |
+ return gl_helper->IsReadbackConfigSupported(bitmap_config); |
+} |
+ |
// static |
void RenderWidgetHostViewPort::GetDefaultScreenInfo( |
blink::WebScreenInfo* results) { |