Index: content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.cc |
diff --git a/content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.cc b/content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.cc |
index 88f1505f814157ad7b1443f8b8dfb02c05192e5e..37495bfa6fc0ead6e32d014d3924dc3fab552a8b 100644 |
--- a/content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.cc |
+++ b/content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.cc |
@@ -253,8 +253,11 @@ void WebGraphicsContext3DCommandBufferImpl::FlipVertically( |
bool WebGraphicsContext3DCommandBufferImpl::readBackFramebuffer( |
unsigned char* pixels, |
- size_t buffer_size) { |
- if (buffer_size != static_cast<size_t>(4 * width() * height())) { |
+ size_t buffer_size, |
+ WebGLId buffer, |
+ int width, |
+ int height) { |
+ if (buffer_size != static_cast<size_t>(4 * width * height)) { |
return false; |
} |
@@ -265,11 +268,11 @@ bool WebGraphicsContext3DCommandBufferImpl::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_ != buffer); |
if (mustRestoreFBO) { |
- gl_->BindFramebuffer(GL_FRAMEBUFFER, 0); |
+ gl_->BindFramebuffer(GL_FRAMEBUFFER, buffer); |
} |
- 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 |
@@ -284,13 +287,19 @@ bool WebGraphicsContext3DCommandBufferImpl::readBackFramebuffer( |
#ifdef FLIP_FRAMEBUFFER_VERTICALLY |
if (pixels) { |
- FlipVertically(pixels, cached_width_, cached_height_); |
+ FlipVertically(pixels, width, height); |
} |
#endif |
return true; |
} |
+bool WebGraphicsContext3DCommandBufferImpl::readBackFramebuffer( |
+ unsigned char* pixels, |
+ size_t buffer_size) { |
+ return readBackFramebuffer(pixels, buffer_size, 0, width(), height()); |
+} |
+ |
void WebGraphicsContext3DCommandBufferImpl::synthesizeGLError( |
WGC3Denum error) { |
if (find(synthetic_errors_.begin(), synthetic_errors_.end(), error) == |