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

Unified Diff: webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc

Issue 7566046: Add WebGraphicsContext support for readbacks from any framebuffer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix in-process default framebuffer Created 9 years, 4 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: webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc
diff --git a/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc b/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc
index c046bc35a6561c3ff503ae6f8959416468f7140f..6872ce22522dcfe2b57de804ea3e1d57c8d678f4 100644
--- a/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc
+++ b/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc
@@ -816,10 +816,13 @@ void WebGraphicsContext3DInProcessCommandBufferImpl::FlipVertically(
bool WebGraphicsContext3DInProcessCommandBufferImpl::readBackFramebuffer(
unsigned char* pixels,
- size_t buffer_size) {
+ size_t buffer_size,
+ WebGLId framebuffer,
+ int width,
+ int height) {
// TODO(gmam): See if we can comment this in.
// ClearContext();
- if (buffer_size != static_cast<size_t>(4 * width() * height())) {
+ if (buffer_size != static_cast<size_t>(4 * width * height)) {
return false;
}
@@ -830,11 +833,11 @@ bool WebGraphicsContext3DInProcessCommandBufferImpl::readBackFramebuffer(
// vertical flip is only a temporary solution anyway until Chrome
// is fully GPU composited, it wasn't worth the complexity.
- bool mustRestoreFBO = (bound_fbo_ != 0);
+ bool mustRestoreFBO = (bound_fbo_ != framebuffer);
if (mustRestoreFBO) {
- gl_->BindFramebuffer(GL_FRAMEBUFFER, 0);
+ gl_->BindFramebuffer(GL_FRAMEBUFFER, framebuffer);
}
- gl_->ReadPixels(0, 0, cached_width_, cached_height_,
+ gl_->ReadPixels(0, 0, width, height,
GL_RGBA, GL_UNSIGNED_BYTE, pixels);
// Swizzle red and blue channels
@@ -849,13 +852,19 @@ bool WebGraphicsContext3DInProcessCommandBufferImpl::readBackFramebuffer(
#ifdef FLIP_FRAMEBUFFER_VERTICALLY
if (pixels) {
- FlipVertically(pixels, cached_width_, cached_height_);
+ FlipVertically(pixels, width, height);
}
#endif
return true;
}
+bool WebGraphicsContext3DInProcessCommandBufferImpl::readBackFramebuffer(
+ unsigned char* pixels,
+ size_t buffer_size) {
+ return readBackFramebuffer(pixels, buffer_size, 0, width(), height());
+}
+
void WebGraphicsContext3DInProcessCommandBufferImpl::synthesizeGLError(
WGC3Denum error) {
if (find(synthetic_errors_.begin(), synthetic_errors_.end(), error) ==
« no previous file with comments | « webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h ('k') | webkit/gpu/webgraphicscontext3d_in_process_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698