| Index: components/display_compositor/buffer_queue.cc
|
| diff --git a/components/display_compositor/buffer_queue.cc b/components/display_compositor/buffer_queue.cc
|
| index afb40e1a4912accfc68929b8d7b72d70e7ac8cb8..4259e5640f00d8ddb8f8d24307aa065c84aded93 100644
|
| --- a/components/display_compositor/buffer_queue.cc
|
| +++ b/components/display_compositor/buffer_queue.cc
|
| @@ -262,6 +262,25 @@ std::unique_ptr<BufferQueue::AllocatedSurface> BufferQueue::GetNextSurface() {
|
| id, stencil, gfx::Rect(size_));
|
| }
|
|
|
| +void BufferQueue::ReadbackDisplayedFramebuffer(
|
| + SkBitmap* bitmap,
|
| + const base::Callback<void(bool)>& callback) {
|
| + if (!displayed_surface_) {
|
| + callback.Run(false);
|
| + return;
|
| + }
|
| + GLuint texture = gl_helper_->CreateTexture();
|
| + ScopedTextureBinder<GL_TEXTURE_2D> texture_binder(gl_, texture);
|
| + gl_->CopyTextureCHROMIUM(displayed_surface_->texture, 0, GL_TEXTURE_2D,
|
| + texture, 0, GL_RGBA, GL_UNSIGNED_BYTE, false, false,
|
| + false);
|
| + bitmap->allocN32Pixels(size_.width(), size_.height());
|
| + gl_helper_->ReadbackTextureAsync(
|
| + texture, size_, static_cast<unsigned char*>(bitmap->getPixels()),
|
| + kRGBA_8888_SkColorType, callback);
|
| + gl_helper_->DeleteTexture(texture);
|
| +}
|
| +
|
| BufferQueue::AllocatedSurface::AllocatedSurface(
|
| BufferQueue* buffer_queue,
|
| std::unique_ptr<gfx::GpuMemoryBuffer> buffer,
|
|
|