Chromium Code Reviews| 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..5a4ce7766cce4e4ba9d94716c1df8aced5d96837 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())) { |
| + int width, |
| + int height, |
| + size_t buffer_size, |
| + WebGLId buffer) { |
| + 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); |
| } |
|
Ken Russell (switch to Gerrit)
2011/08/04 22:55:07
Do you think we might want or need checks about th
jbauman
2011/08/04 23:20:21
Those can be expensive, so I'd rather avoid them (
|
| - 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, width(), height(), buffer_size, 0); |
| +} |
| + |
| void WebGraphicsContext3DCommandBufferImpl::synthesizeGLError( |
| WGC3Denum error) { |
| if (find(synthetic_errors_.begin(), synthetic_errors_.end(), error) == |