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

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

Issue 1095993002: Fallback to RGBA_8888 if readback format is not supported (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing comments Created 5 years, 8 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
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_android.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 f687931630d13362e870a52b05148dbc3da4b7a4..1fd69d500fb7deb36af42b6169431af8c5112ce8 100644
--- a/content/browser/renderer_host/render_widget_host_view_android.cc
+++ b/content/browser/renderer_host/render_widget_host_view_android.cc
@@ -1969,14 +1969,14 @@ void RenderWidgetHostViewAndroid::OnLostResources() {
}
// static
-void
-RenderWidgetHostViewAndroid::PrepareTextureCopyOutputResultForDelegatedReadback(
- const gfx::Size& dst_size_in_pixel,
- const SkColorType color_type,
- const base::TimeTicks& start_time,
- scoped_refptr<cc::Layer> readback_layer,
- ReadbackRequestCallback& callback,
- scoped_ptr<cc::CopyOutputResult> result) {
+void RenderWidgetHostViewAndroid::
+ PrepareTextureCopyOutputResultForDelegatedReadback(
+ const gfx::Size& dst_size_in_pixel,
+ SkColorType color_type,
+ const base::TimeTicks& start_time,
+ scoped_refptr<cc::Layer> readback_layer,
+ ReadbackRequestCallback& callback,
+ scoped_ptr<cc::CopyOutputResult> result) {
readback_layer->RemoveFromParent();
PrepareTextureCopyOutputResult(
dst_size_in_pixel, color_type, start_time, callback, result.Pass());
@@ -1985,7 +1985,7 @@ RenderWidgetHostViewAndroid::PrepareTextureCopyOutputResultForDelegatedReadback(
// static
void RenderWidgetHostViewAndroid::PrepareTextureCopyOutputResult(
const gfx::Size& dst_size_in_pixel,
- const SkColorType color_type,
+ SkColorType color_type,
const base::TimeTicks& start_time,
ReadbackRequestCallback& callback,
scoped_ptr<cc::CopyOutputResult> result) {
@@ -2003,6 +2003,11 @@ void RenderWidgetHostViewAndroid::PrepareTextureCopyOutputResult(
else
output_size_in_pixel = dst_size_in_pixel;
+ GLHelper* gl_helper = GetPostReadbackGLHelper();
+ if (!gl_helper)
+ return;
+ if (!gl_helper->IsReadbackConfigSupported(color_type))
+ color_type = kRGBA_8888_SkColorType;
scoped_ptr<SkBitmap> bitmap(new SkBitmap);
if (!bitmap->tryAllocPixels(SkImageInfo::Make(output_size_in_pixel.width(),
output_size_in_pixel.height(),
@@ -2011,9 +2016,6 @@ void RenderWidgetHostViewAndroid::PrepareTextureCopyOutputResult(
return;
}
- GLHelper* gl_helper = GetPostReadbackGLHelper();
- if (!gl_helper || !gl_helper->IsReadbackConfigSupported(color_type))
- return;
scoped_ptr<SkAutoLockPixels> bitmap_pixels_lock(
new SkAutoLockPixels(*bitmap));
@@ -2045,21 +2047,6 @@ void RenderWidgetHostViewAndroid::PrepareTextureCopyOutputResult(
GLHelper::SCALER_QUALITY_GOOD);
}
-SkColorType RenderWidgetHostViewAndroid::PreferredReadbackFormat() {
- // Define the criteria here. If say the 16 texture readback is
- // supported we should go with that (this degrades quality)
- // or stick back to the default format.
- if (base::SysInfo::IsLowEndDevice()) {
- // TODO(sievers): Cannot use GLHelper here. Instead remove this API
- // and have CopyFromCompositingSurface() fall back to RGB8 if 565 was
- // requested but is not supported.
- GLHelper* gl_helper = GetPostReadbackGLHelper();
- if (gl_helper && gl_helper->IsReadbackConfigSupported(kRGB_565_SkColorType))
- return kRGB_565_SkColorType;
- }
- return kN32_SkColorType;
-}
-
void RenderWidgetHostViewAndroid::OnStylusSelectBegin(float x0,
float y0,
float x1,
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_android.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698