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

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

Issue 12896006: mac: Clean up a few more uses of USE_SKIA (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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
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 704 matching lines...) Expand 10 before | Expand all | Expand 10 after
715 return context_->CreateParentTexture(gfx::Size(width, height)); 715 return context_->CreateParentTexture(gfx::Size(width, height));
716 } 716 }
717 717
718 void WebGraphicsContext3DInProcessCommandBufferImpl::deleteCompositorTexture( 718 void WebGraphicsContext3DInProcessCommandBufferImpl::deleteCompositorTexture(
719 WebGLId parent_texture) { 719 WebGLId parent_texture) {
720 // TODO(gmam): See if we can comment this in. 720 // TODO(gmam): See if we can comment this in.
721 // ClearContext(); 721 // ClearContext();
722 context_->DeleteParentTexture(parent_texture); 722 context_->DeleteParentTexture(parent_texture);
723 } 723 }
724 724
725 #ifdef FLIP_FRAMEBUFFER_VERTICALLY
726 void WebGraphicsContext3DInProcessCommandBufferImpl::FlipVertically( 725 void WebGraphicsContext3DInProcessCommandBufferImpl::FlipVertically(
727 uint8* framebuffer, 726 uint8* framebuffer,
728 unsigned int width, 727 unsigned int width,
729 unsigned int height) { 728 unsigned int height) {
730 if (width == 0) 729 if (width == 0)
731 return; 730 return;
732 scanline_.resize(width * 4); 731 scanline_.resize(width * 4);
733 uint8* scanline = &scanline_[0]; 732 uint8* scanline = &scanline_[0];
734 unsigned int row_bytes = width * 4; 733 unsigned int row_bytes = width * 4;
735 unsigned int count = height / 2; 734 unsigned int count = height / 2;
736 for (unsigned int i = 0; i < count; i++) { 735 for (unsigned int i = 0; i < count; i++) {
737 uint8* row_a = framebuffer + i * row_bytes; 736 uint8* row_a = framebuffer + i * row_bytes;
738 uint8* row_b = framebuffer + (height - i - 1) * row_bytes; 737 uint8* row_b = framebuffer + (height - i - 1) * row_bytes;
739 // TODO(kbr): this is where the multiplication of the alpha 738 // TODO(kbr): this is where the multiplication of the alpha
740 // channel into the color buffer will need to occur if the 739 // channel into the color buffer will need to occur if the
741 // user specifies the "premultiplyAlpha" flag in the context 740 // user specifies the "premultiplyAlpha" flag in the context
742 // creation attributes. 741 // creation attributes.
743 memcpy(scanline, row_b, row_bytes); 742 memcpy(scanline, row_b, row_bytes);
744 memcpy(row_b, row_a, row_bytes); 743 memcpy(row_b, row_a, row_bytes);
745 memcpy(row_a, scanline, row_bytes); 744 memcpy(row_a, scanline, row_bytes);
746 } 745 }
747 } 746 }
748 #endif
749 747
750 bool WebGraphicsContext3DInProcessCommandBufferImpl::readBackFramebuffer( 748 bool WebGraphicsContext3DInProcessCommandBufferImpl::readBackFramebuffer(
751 unsigned char* pixels, 749 unsigned char* pixels,
752 size_t buffer_size, 750 size_t buffer_size,
753 WebGLId framebuffer, 751 WebGLId framebuffer,
754 int width, 752 int width,
755 int height) { 753 int height) {
756 // TODO(gmam): See if we can comment this in. 754 // TODO(gmam): See if we can comment this in.
757 // ClearContext(); 755 // ClearContext();
758 if (buffer_size != static_cast<size_t>(4 * width * height)) { 756 if (buffer_size != static_cast<size_t>(4 * width * height)) {
(...skipping 16 matching lines...) Expand all
775 // Swizzle red and blue channels 773 // Swizzle red and blue channels
776 // TODO(kbr): expose GL_BGRA as extension 774 // TODO(kbr): expose GL_BGRA as extension
777 for (size_t i = 0; i < buffer_size; i += 4) { 775 for (size_t i = 0; i < buffer_size; i += 4) {
778 std::swap(pixels[i], pixels[i + 2]); 776 std::swap(pixels[i], pixels[i + 2]);
779 } 777 }
780 778
781 if (mustRestoreFBO) { 779 if (mustRestoreFBO) {
782 gl_->BindFramebuffer(GL_FRAMEBUFFER, bound_fbo_); 780 gl_->BindFramebuffer(GL_FRAMEBUFFER, bound_fbo_);
783 } 781 }
784 782
785 #ifdef FLIP_FRAMEBUFFER_VERTICALLY
786 if (pixels) { 783 if (pixels) {
787 FlipVertically(pixels, width, height); 784 FlipVertically(pixels, width, height);
788 } 785 }
789 #endif
790 786
791 return true; 787 return true;
792 } 788 }
793 789
794 bool WebGraphicsContext3DInProcessCommandBufferImpl::readBackFramebuffer( 790 bool WebGraphicsContext3DInProcessCommandBufferImpl::readBackFramebuffer(
795 unsigned char* pixels, 791 unsigned char* pixels,
796 size_t buffer_size) { 792 size_t buffer_size) {
797 return readBackFramebuffer(pixels, buffer_size, 0, width(), height()); 793 return readBackFramebuffer(pixels, buffer_size, 0, width(), height());
798 } 794 }
799 795
(...skipping 884 matching lines...) Expand 10 before | Expand all | Expand 10 after
1684 DELEGATE_TO_GL_1(genMailboxCHROMIUM, GenMailboxCHROMIUM, WGC3Dbyte*) 1680 DELEGATE_TO_GL_1(genMailboxCHROMIUM, GenMailboxCHROMIUM, WGC3Dbyte*)
1685 DELEGATE_TO_GL_2(produceTextureCHROMIUM, ProduceTextureCHROMIUM, 1681 DELEGATE_TO_GL_2(produceTextureCHROMIUM, ProduceTextureCHROMIUM,
1686 WGC3Denum, const WGC3Dbyte*) 1682 WGC3Denum, const WGC3Dbyte*)
1687 DELEGATE_TO_GL_2(consumeTextureCHROMIUM, ConsumeTextureCHROMIUM, 1683 DELEGATE_TO_GL_2(consumeTextureCHROMIUM, ConsumeTextureCHROMIUM,
1688 WGC3Denum, const WGC3Dbyte*) 1684 WGC3Denum, const WGC3Dbyte*)
1689 1685
1690 DELEGATE_TO_GL_2(drawBuffersEXT, DrawBuffersEXT, 1686 DELEGATE_TO_GL_2(drawBuffersEXT, DrawBuffersEXT,
1691 WGC3Dsizei, const WGC3Denum*) 1687 WGC3Dsizei, const WGC3Denum*)
1692 } // namespace gpu 1688 } // namespace gpu
1693 } // namespace webkit 1689 } // namespace webkit
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698