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

Unified Diff: components/display_compositor/buffer_queue.cc

Issue 2465093002: cc: Add OutputSurface state snapshots.
Patch Set: nits Created 4 years, 1 month 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: components/display_compositor/buffer_queue.cc
diff --git a/components/display_compositor/buffer_queue.cc b/components/display_compositor/buffer_queue.cc
index fafdb406b4feee839d0736a838647d135aa1101e..cad2c921bd500930bc3805614c4fd81288b42fb8 100644
--- a/components/display_compositor/buffer_queue.cc
+++ b/components/display_compositor/buffer_queue.cc
@@ -243,6 +243,24 @@ std::unique_ptr<BufferQueue::AllocatedSurface> BufferQueue::GetNextSurface() {
id, 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, texture, 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,

Powered by Google App Engine
This is Rietveld 408576698