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..fdabd1b5e07b6eebd7148e9ab6dcee1164c24dd9 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) { |
+ int width, |
+ int height, |
+ size_t buffer_size, |
+ WebGLId framebuffer) { |
// 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, width(), height(), buffer_size, 0); |
+} |
+ |
void WebGraphicsContext3DInProcessCommandBufferImpl::synthesizeGLError( |
WGC3Denum error) { |
if (find(synthetic_errors_.begin(), synthetic_errors_.end(), error) == |