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

Side by Side Diff: cc/shader.cc

Issue 11189043: cc: Rename cc classes and members to match filenames (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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 "config.h" 5 #include "config.h"
6 6
7 #include "cc/shader.h" 7 #include "cc/shader.h"
8 8
9 #include <public/WebGraphicsContext3D.h> 9 #include <public/WebGraphicsContext3D.h>
10 #include <wtf/StdLibExtras.h> 10 #include <wtf/StdLibExtras.h>
(...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after
751 { 751 {
752 } 752 }
753 753
754 void FragmentShaderYUVVideo::init(WebGraphicsContext3D* context, unsigned progra m, bool usingBindUniform, int* baseUniformIndex) 754 void FragmentShaderYUVVideo::init(WebGraphicsContext3D* context, unsigned progra m, bool usingBindUniform, int* baseUniformIndex)
755 { 755 {
756 static const char* shaderUniforms[] = { 756 static const char* shaderUniforms[] = {
757 "y_texture", 757 "y_texture",
758 "u_texture", 758 "u_texture",
759 "v_texture", 759 "v_texture",
760 "alpha", 760 "alpha",
761 "cc_matrix", 761 "matrix",
762 "yuv_adj", 762 "yuv_adj",
763 }; 763 };
764 int locations[6]; 764 int locations[6];
765 765
766 getProgramUniformLocations(context, program, shaderUniforms, WTF_ARRAY_LENGT H(shaderUniforms), WTF_ARRAY_LENGTH(locations), locations, usingBindUniform, bas eUniformIndex); 766 getProgramUniformLocations(context, program, shaderUniforms, WTF_ARRAY_LENGT H(shaderUniforms), WTF_ARRAY_LENGTH(locations), locations, usingBindUniform, bas eUniformIndex);
767 767
768 m_yTextureLocation = locations[0]; 768 m_yTextureLocation = locations[0];
769 m_uTextureLocation = locations[1]; 769 m_uTextureLocation = locations[1];
770 m_vTextureLocation = locations[2]; 770 m_vTextureLocation = locations[2];
771 m_alphaLocation = locations[3]; 771 m_alphaLocation = locations[3];
772 m_ccMatrixLocation = locations[4]; 772 m_ccMatrixLocation = locations[4];
773 m_yuvAdjLocation = locations[5]; 773 m_yuvAdjLocation = locations[5];
774 774
775 ASSERT(m_yTextureLocation != -1 && m_uTextureLocation != -1 && m_vTextureLoc ation != -1 775 ASSERT(m_yTextureLocation != -1 && m_uTextureLocation != -1 && m_vTextureLoc ation != -1
776 && m_alphaLocation != -1 && m_ccMatrixLocation != -1 && m_yuvAdjLocat ion != -1); 776 && m_alphaLocation != -1 && m_ccMatrixLocation != -1 && m_yuvAdjLocat ion != -1);
777 } 777 }
778 778
779 std::string FragmentShaderYUVVideo::getShaderString() const 779 std::string FragmentShaderYUVVideo::getShaderString() const
780 { 780 {
781 return SHADER( 781 return SHADER(
782 precision mediump float; 782 precision mediump float;
783 precision mediump int; 783 precision mediump int;
784 varying vec2 y_texCoord; 784 varying vec2 y_texCoord;
785 varying vec2 uv_texCoord; 785 varying vec2 uv_texCoord;
786 uniform sampler2D y_texture; 786 uniform sampler2D y_texture;
787 uniform sampler2D u_texture; 787 uniform sampler2D u_texture;
788 uniform sampler2D v_texture; 788 uniform sampler2D v_texture;
789 uniform float alpha; 789 uniform float alpha;
790 uniform vec3 yuv_adj; 790 uniform vec3 yuv_adj;
791 uniform mat3 cc_matrix; 791 uniform mat3 matrix;
792 void main() 792 void main()
793 { 793 {
794 float y_raw = texture2D(y_texture, y_texCoord).x; 794 float y_raw = texture2D(y_texture, y_texCoord).x;
795 float u_unsigned = texture2D(u_texture, uv_texCoord).x; 795 float u_unsigned = texture2D(u_texture, uv_texCoord).x;
796 float v_unsigned = texture2D(v_texture, uv_texCoord).x; 796 float v_unsigned = texture2D(v_texture, uv_texCoord).x;
797 vec3 yuv = vec3(y_raw, u_unsigned, v_unsigned) + yuv_adj; 797 vec3 yuv = vec3(y_raw, u_unsigned, v_unsigned) + yuv_adj;
798 vec3 rgb = cc_matrix * yuv; 798 vec3 rgb = matrix * yuv;
799 gl_FragColor = vec4(rgb, float(1)) * alpha; 799 gl_FragColor = vec4(rgb, float(1)) * alpha;
800 } 800 }
801 ); 801 );
802 } 802 }
803 803
804 FragmentShaderColor::FragmentShaderColor() 804 FragmentShaderColor::FragmentShaderColor()
805 : m_colorLocation(-1) 805 : m_colorLocation(-1)
806 { 806 {
807 } 807 }
808 808
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
875 vec4 color2 = color; 875 vec4 color2 = color;
876 vec2 texCoord = clamp(v_texCoord, 0.0, 1.0) * texTransform.zw + texT ransform.xy; 876 vec2 texCoord = clamp(v_texCoord, 0.0, 1.0) * texTransform.zw + texT ransform.xy;
877 vec2 coord = mod(floor(texCoord * frequency * 2.0), 2.0); 877 vec2 coord = mod(floor(texCoord * frequency * 2.0), 2.0);
878 float picker = abs(coord.x - coord.y); 878 float picker = abs(coord.x - coord.y);
879 gl_FragColor = mix(color1, color2, picker) * alpha; 879 gl_FragColor = mix(color1, color2, picker) * alpha;
880 } 880 }
881 ); 881 );
882 } 882 }
883 883
884 } // namespace cc 884 } // namespace cc
OLDNEW
« cc/active_animation.h ('K') | « cc/shader.h ('k') | cc/shared_quad_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698