diff options
author | jbauman@chromium.org <jbauman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-13 04:00:44 +0000 |
---|---|---|
committer | jbauman@chromium.org <jbauman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-13 04:00:44 +0000 |
commit | 53ea9bcec4aa0d30f08113217a9f64af8e638608 (patch) | |
tree | 7d97e0348ce6ad9364a2823b91ba10c914364fe5 /webkit/common | |
parent | ae35eaa0e151570dace1320c83dd98047371d1a7 (diff) | |
download | chromium_src-53ea9bcec4aa0d30f08113217a9f64af8e638608.zip chromium_src-53ea9bcec4aa0d30f08113217a9f64af8e638608.tar.gz chromium_src-53ea9bcec4aa0d30f08113217a9f64af8e638608.tar.bz2 |
Remove WebGraphicsContext::readBackFramebuffer implementation.
This isn't used anymore.
BUG=
Review URL: https://chromiumcodereview.appspot.com/18464007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@211528 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/common')
-rw-r--r-- | webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc | 75 | ||||
-rw-r--r-- | webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h | 13 |
2 files changed, 1 insertions, 87 deletions
diff --git a/webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc b/webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc index 2ddbebc..f9fdc9d 100644 --- a/webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc +++ b/webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc @@ -102,8 +102,7 @@ WebGraphicsContext3DInProcessCommandBufferImpl:: context_lost_reason_(GL_NO_ERROR), attributes_(attributes), cached_width_(0), - cached_height_(0), - bound_fbo_(0) { + cached_height_(0) { } WebGraphicsContext3DInProcessCommandBufferImpl:: @@ -246,77 +245,6 @@ void WebGraphicsContext3DInProcessCommandBufferImpl::reshapeWithScaleFactor( gl_->ResizeCHROMIUM(width, height, scale_factor); } -void WebGraphicsContext3DInProcessCommandBufferImpl::FlipVertically( - uint8* framebuffer, - unsigned int width, - unsigned int height) { - if (width == 0) - return; - scanline_.resize(width * 4); - uint8* scanline = &scanline_[0]; - unsigned int row_bytes = width * 4; - unsigned int count = height / 2; - for (unsigned int i = 0; i < count; i++) { - uint8* row_a = framebuffer + i * row_bytes; - uint8* row_b = framebuffer + (height - i - 1) * row_bytes; - // TODO(kbr): this is where the multiplication of the alpha - // channel into the color buffer will need to occur if the - // user specifies the "premultiplyAlpha" flag in the context - // creation attributes. - memcpy(scanline, row_b, row_bytes); - memcpy(row_b, row_a, row_bytes); - memcpy(row_a, scanline, row_bytes); - } -} - -bool WebGraphicsContext3DInProcessCommandBufferImpl::readBackFramebuffer( - unsigned char* pixels, - 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)) { - return false; - } - - // Earlier versions of this code used the GPU to flip the - // framebuffer vertically before reading it back for compositing - // via software. This code was quite complicated, used a lot of - // GPU memory, and didn't provide an obvious speedup. Since this - // vertical flip is only a temporary solution anyway until Chrome - // is fully GPU composited, it wasn't worth the complexity. - - bool mustRestoreFBO = (bound_fbo_ != framebuffer); - if (mustRestoreFBO) { - gl_->BindFramebuffer(GL_FRAMEBUFFER, framebuffer); - } - gl_->ReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, pixels); - - // Swizzle red and blue channels - // TODO(kbr): expose GL_BGRA as extension - for (size_t i = 0; i < buffer_size; i += 4) { - std::swap(pixels[i], pixels[i + 2]); - } - - if (mustRestoreFBO) { - gl_->BindFramebuffer(GL_FRAMEBUFFER, bound_fbo_); - } - - if (pixels) { - FlipVertically(pixels, width, height); - } - - 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 (std::find(synthetic_errors_.begin(), synthetic_errors_.end(), error) == @@ -539,7 +467,6 @@ void WebGraphicsContext3DInProcessCommandBufferImpl::bindFramebuffer( WebGLId framebuffer) { ClearContext(); gl_->BindFramebuffer(target, framebuffer); - bound_fbo_ = framebuffer; } DELEGATE_TO_GL_2(bindRenderbuffer, BindRenderbuffer, WGC3Denum, WebGLId) diff --git a/webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h b/webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h index bb4f3da..c7e5ab2 100644 --- a/webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h +++ b/webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h @@ -66,10 +66,6 @@ class WEBKIT_GPU_EXPORT WebGraphicsContext3DInProcessCommandBufferImpl virtual void reshape(int width, int height); virtual void reshapeWithScaleFactor(int width, int height, float scaleFactor); - virtual bool readBackFramebuffer(unsigned char* pixels, size_t buffer_size); - virtual bool readBackFramebuffer(unsigned char* pixels, size_t buffer_size, - WebGLId framebuffer, int width, int height); - virtual void prepareTexture(); virtual void postSubBufferCHROMIUM(int x, int y, int width, int height); @@ -573,17 +569,8 @@ class WEBKIT_GPU_EXPORT WebGraphicsContext3DInProcessCommandBufferImpl WebKit::WebGraphicsContext3D::Attributes attributes_; int cached_width_, cached_height_; - // For tracking which FBO is bound. - WebGLId bound_fbo_; - // Errors raised by synthesizeGLError(). std::vector<WGC3Denum> synthetic_errors_; - - std::vector<uint8> scanline_; - - void FlipVertically(uint8* framebuffer, - unsigned int width, - unsigned int height); }; } // namespace gpu |