| 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 574c88fb9f24b07bc52da3014d167cb083a98974..d1de2e21c3d918eca2f2eba164669e656e432c7c 100644
|
| --- a/content/browser/renderer_host/render_widget_host_view_android.cc
|
| +++ b/content/browser/renderer_host/render_widget_host_view_android.cc
|
| @@ -971,7 +971,8 @@ void RenderWidgetHostViewAndroid::CopyFromCompositingSurface(
|
| start_time,
|
| readback_layer,
|
| callback));
|
| - request->set_area(src_subrect_in_pixel);
|
| + if (!src_subrect_in_pixel.IsEmpty())
|
| + request->set_area(src_subrect_in_pixel);
|
| readback_layer->RequestCopyOfOutput(request.Pass());
|
| }
|
|
|
| @@ -1285,6 +1286,20 @@ void RenderWidgetHostViewAndroid::SynchronousCopyContents(
|
| const gfx::Size& dst_size_in_pixel,
|
| ReadbackRequestCallback& callback,
|
| const SkColorType color_type) {
|
| + gfx::Size input_size_in_pixel;
|
| + if (src_subrect_in_pixel.IsEmpty())
|
| + input_size_in_pixel = content_size_in_layer_;
|
| + else
|
| + input_size_in_pixel = src_subrect_in_pixel.size();
|
| +
|
| + gfx::Size output_size_in_pixel;
|
| + if (dst_size_in_pixel.IsEmpty())
|
| + output_size_in_pixel = input_size_in_pixel;
|
| + else
|
| + output_size_in_pixel = dst_size_in_pixel;
|
| + int output_width = output_size_in_pixel.width();
|
| + int output_height = output_size_in_pixel.height();
|
| +
|
| SynchronousCompositor* compositor =
|
| SynchronousCompositorImpl::FromID(host_->GetProcess()->GetID(),
|
| host_->GetRoutingID());
|
| @@ -1294,14 +1309,14 @@ void RenderWidgetHostViewAndroid::SynchronousCopyContents(
|
| }
|
|
|
| SkBitmap bitmap;
|
| - bitmap.allocPixels(SkImageInfo::Make(dst_size_in_pixel.width(),
|
| - dst_size_in_pixel.height(),
|
| + bitmap.allocPixels(SkImageInfo::Make(output_width,
|
| + output_height,
|
| color_type,
|
| kPremul_SkAlphaType));
|
| SkCanvas canvas(bitmap);
|
| canvas.scale(
|
| - (float)dst_size_in_pixel.width() / (float)src_subrect_in_pixel.width(),
|
| - (float)dst_size_in_pixel.height() / (float)src_subrect_in_pixel.height());
|
| + (float)output_width / (float)input_size_in_pixel.width(),
|
| + (float)output_height / (float)input_size_in_pixel.height());
|
| compositor->DemandDrawSw(&canvas);
|
| callback.Run(bitmap, READBACK_SUCCESS);
|
| }
|
| @@ -1805,9 +1820,15 @@ void RenderWidgetHostViewAndroid::PrepareTextureCopyOutputResult(
|
| if (!result->HasTexture() || result->IsEmpty() || result->size().IsEmpty())
|
| return;
|
|
|
| + gfx::Size output_size_in_pixel;
|
| + if (dst_size_in_pixel.IsEmpty())
|
| + output_size_in_pixel = result->size();
|
| + else
|
| + output_size_in_pixel = dst_size_in_pixel;
|
| +
|
| scoped_ptr<SkBitmap> bitmap(new SkBitmap);
|
| - if (!bitmap->tryAllocPixels(SkImageInfo::Make(dst_size_in_pixel.width(),
|
| - dst_size_in_pixel.height(),
|
| + if (!bitmap->tryAllocPixels(SkImageInfo::Make(output_size_in_pixel.width(),
|
| + output_size_in_pixel.height(),
|
| color_type,
|
| kOpaque_SkAlphaType))) {
|
| return;
|
| @@ -1835,7 +1856,7 @@ void RenderWidgetHostViewAndroid::PrepareTextureCopyOutputResult(
|
| texture_mailbox.sync_point(),
|
| result->size(),
|
| gfx::Rect(result->size()),
|
| - dst_size_in_pixel,
|
| + output_size_in_pixel,
|
| pixels,
|
| color_type,
|
| base::Bind(&CopyFromCompositingSurfaceFinished,
|
|
|