Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(47)

Unified Diff: content/browser/renderer_host/render_widget_host_view_android.cc

Issue 149123008: Implement GLHelperReadbackSupport for GLHelper usage. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unused gl_helper member. Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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) {
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_android.h ('k') | content/common/gpu/client/gl_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698