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

Side by Side Diff: webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc

Issue 12250017: Fixed bug in allocation of temporary scanline during frame buffer readback. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added early out from out-of-process command buffer impl. Created 7 years, 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h" 5 #include "webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h"
6 6
7 #include <GLES2/gl2.h> 7 #include <GLES2/gl2.h>
8 #ifndef GL_GLEXT_PROTOTYPES 8 #ifndef GL_GLEXT_PROTOTYPES
9 #define GL_GLEXT_PROTOTYPES 1 9 #define GL_GLEXT_PROTOTYPES 1
10 #endif 10 #endif
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 699
700 void WebGraphicsContext3DInProcessCommandBufferImpl::reshape( 700 void WebGraphicsContext3DInProcessCommandBufferImpl::reshape(
701 int width, int height) { 701 int width, int height) {
702 cached_width_ = width; 702 cached_width_ = width;
703 cached_height_ = height; 703 cached_height_ = height;
704 704
705 // TODO(gmam): See if we can comment this in. 705 // TODO(gmam): See if we can comment this in.
706 // ClearContext(); 706 // ClearContext();
707 707
708 gl_->ResizeCHROMIUM(width, height); 708 gl_->ResizeCHROMIUM(width, height);
709
710 #ifdef FLIP_FRAMEBUFFER_VERTICALLY
711 scanline_.reset(new uint8[width * 4]);
712 #endif // FLIP_FRAMEBUFFER_VERTICALLY
713 } 709 }
714 710
715 WebGLId WebGraphicsContext3DInProcessCommandBufferImpl::createCompositorTexture( 711 WebGLId WebGraphicsContext3DInProcessCommandBufferImpl::createCompositorTexture(
716 WGC3Dsizei width, WGC3Dsizei height) { 712 WGC3Dsizei width, WGC3Dsizei height) {
717 // TODO(gmam): See if we can comment this in. 713 // TODO(gmam): See if we can comment this in.
718 // ClearContext(); 714 // ClearContext();
719 return context_->CreateParentTexture(gfx::Size(width, height)); 715 return context_->CreateParentTexture(gfx::Size(width, height));
720 } 716 }
721 717
722 void WebGraphicsContext3DInProcessCommandBufferImpl::deleteCompositorTexture( 718 void WebGraphicsContext3DInProcessCommandBufferImpl::deleteCompositorTexture(
723 WebGLId parent_texture) { 719 WebGLId parent_texture) {
724 // TODO(gmam): See if we can comment this in. 720 // TODO(gmam): See if we can comment this in.
725 // ClearContext(); 721 // ClearContext();
726 context_->DeleteParentTexture(parent_texture); 722 context_->DeleteParentTexture(parent_texture);
727 } 723 }
728 724
729 #ifdef FLIP_FRAMEBUFFER_VERTICALLY 725 #ifdef FLIP_FRAMEBUFFER_VERTICALLY
730 void WebGraphicsContext3DInProcessCommandBufferImpl::FlipVertically( 726 void WebGraphicsContext3DInProcessCommandBufferImpl::FlipVertically(
731 uint8* framebuffer, 727 uint8* framebuffer,
732 unsigned int width, 728 unsigned int width,
733 unsigned int height) { 729 unsigned int height) {
734 uint8* scanline = scanline_.get(); 730 if (width == 0)
735 if (!scanline)
736 return; 731 return;
732 scanline_.resize(width * 4);
733 uint8* scanline = &scanline_[0];
737 unsigned int row_bytes = width * 4; 734 unsigned int row_bytes = width * 4;
738 unsigned int count = height / 2; 735 unsigned int count = height / 2;
739 for (unsigned int i = 0; i < count; i++) { 736 for (unsigned int i = 0; i < count; i++) {
740 uint8* row_a = framebuffer + i * row_bytes; 737 uint8* row_a = framebuffer + i * row_bytes;
741 uint8* row_b = framebuffer + (height - i - 1) * row_bytes; 738 uint8* row_b = framebuffer + (height - i - 1) * row_bytes;
742 // TODO(kbr): this is where the multiplication of the alpha 739 // TODO(kbr): this is where the multiplication of the alpha
743 // channel into the color buffer will need to occur if the 740 // channel into the color buffer will need to occur if the
744 // user specifies the "premultiplyAlpha" flag in the context 741 // user specifies the "premultiplyAlpha" flag in the context
745 // creation attributes. 742 // creation attributes.
746 memcpy(scanline, row_b, row_bytes); 743 memcpy(scanline, row_b, row_bytes);
(...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after
1685 DELEGATE_TO_GL(shallowFlushCHROMIUM, ShallowFlushCHROMIUM) 1682 DELEGATE_TO_GL(shallowFlushCHROMIUM, ShallowFlushCHROMIUM)
1686 1683
1687 DELEGATE_TO_GL_1(genMailboxCHROMIUM, GenMailboxCHROMIUM, WGC3Dbyte*) 1684 DELEGATE_TO_GL_1(genMailboxCHROMIUM, GenMailboxCHROMIUM, WGC3Dbyte*)
1688 DELEGATE_TO_GL_2(produceTextureCHROMIUM, ProduceTextureCHROMIUM, 1685 DELEGATE_TO_GL_2(produceTextureCHROMIUM, ProduceTextureCHROMIUM,
1689 WGC3Denum, const WGC3Dbyte*) 1686 WGC3Denum, const WGC3Dbyte*)
1690 DELEGATE_TO_GL_2(consumeTextureCHROMIUM, ConsumeTextureCHROMIUM, 1687 DELEGATE_TO_GL_2(consumeTextureCHROMIUM, ConsumeTextureCHROMIUM,
1691 WGC3Denum, const WGC3Dbyte*) 1688 WGC3Denum, const WGC3Dbyte*)
1692 1689
1693 } // namespace gpu 1690 } // namespace gpu
1694 } // namespace webkit 1691 } // namespace webkit
OLDNEW
« no previous file with comments | « webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698