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

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

Issue 143683003: Support format using enum argument for Async readback (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Code changes as per review. Created 6 years, 11 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_aura.cc
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc
index f262a3d8cb6f18cfe74ab68cc880c41f13b7e4bc..3e4c1ca5a68af97e127f85841fdc0a5ba4c9aa27 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -1089,7 +1089,15 @@ void RenderWidgetHostViewAura::CopyFromCompositingSurface(
const gfx::Rect& src_subrect,
const gfx::Size& dst_size,
const base::Callback<void(bool, const SkBitmap&)>& callback,
- bool readback_config_rgb565) {
+ const SkBitmap::Config config) {
+ // Only ARGB888 and RGB565 supported as of now.
+ bool format_support = ((config == SkBitmap::kRGB_565_Config) ||
+ (config == SkBitmap::kARGB_8888_Config));
+ if (!format_support) {
+ DCHECK(format_support);
+ callback.Run(false, SkBitmap());
+ return;
+ }
if (!CanCopyToBitmap()) {
callback.Run(false, SkBitmap());
return;
@@ -1100,7 +1108,7 @@ void RenderWidgetHostViewAura::CopyFromCompositingSurface(
cc::CopyOutputRequest::CreateRequest(base::Bind(
&RenderWidgetHostViewAura::CopyFromCompositingSurfaceHasResult,
dst_size_in_pixel,
- readback_config_rgb565,
+ config,
callback));
gfx::Rect src_subrect_in_pixel =
ConvertRectToPixel(current_device_scale_factor_, src_subrect);
@@ -1833,7 +1841,7 @@ void RenderWidgetHostViewAura::SetSurfaceNotInUseByCompositor(
// static
void RenderWidgetHostViewAura::CopyFromCompositingSurfaceHasResult(
const gfx::Size& dst_size_in_pixel,
- bool readback_config_rgb565,
+ const SkBitmap::Config config,
const base::Callback<void(bool, const SkBitmap&)>& callback,
scoped_ptr<cc::CopyOutputResult> result) {
if (result->IsEmpty() || result->size().IsEmpty()) {
@@ -1842,7 +1850,7 @@ void RenderWidgetHostViewAura::CopyFromCompositingSurfaceHasResult(
}
if (result->HasTexture()) {
- PrepareTextureCopyOutputResult(dst_size_in_pixel, readback_config_rgb565,
+ PrepareTextureCopyOutputResult(dst_size_in_pixel, config,
callback,
result.Pass());
return;
@@ -1866,7 +1874,7 @@ static void CopyFromCompositingSurfaceFinished(
// static
void RenderWidgetHostViewAura::PrepareTextureCopyOutputResult(
const gfx::Size& dst_size_in_pixel,
- bool readback_config_rgb565,
+ const SkBitmap::Config config,
const base::Callback<void(bool, const SkBitmap&)>& callback,
scoped_ptr<cc::CopyOutputResult> result) {
base::ScopedClosureRunner scoped_callback_runner(
@@ -1908,7 +1916,7 @@ void RenderWidgetHostViewAura::PrepareTextureCopyOutputResult(
gfx::Rect(result->size()),
dst_size_in_pixel,
pixels,
- readback_config_rgb565,
+ config,
base::Bind(&CopyFromCompositingSurfaceFinished,
callback,
base::Passed(&release_callback),

Powered by Google App Engine
This is Rietveld 408576698