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

Unified Diff: components/display_compositor/buffer_queue.cc

Issue 2465093002: cc: Add OutputSurface state snapshots.
Patch Set: rebase Created 3 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: 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,
« no previous file with comments | « components/display_compositor/buffer_queue.h ('k') | content/browser/compositor/browser_compositor_output_surface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698