OLD | NEW |
---|---|
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 "cc/output/shader.h" | 5 #include "cc/output/shader.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 2087 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2098 a_texture_location_(-1), | 2098 a_texture_location_(-1), |
2099 alpha_location_(-1), | 2099 alpha_location_(-1), |
2100 yuv_matrix_location_(-1), | 2100 yuv_matrix_location_(-1), |
2101 yuv_adj_location_(-1) { | 2101 yuv_adj_location_(-1) { |
2102 } | 2102 } |
2103 | 2103 |
2104 void FragmentShaderYUVAVideo::Init(GLES2Interface* context, | 2104 void FragmentShaderYUVAVideo::Init(GLES2Interface* context, |
2105 unsigned program, | 2105 unsigned program, |
2106 int* base_uniform_index) { | 2106 int* base_uniform_index) { |
2107 static const char* uniforms[] = { | 2107 static const char* uniforms[] = { |
2108 "y_texture", | 2108 "y_texture", "u_texture", "v_texture", "a_texture", "alpha", |
2109 "u_texture", | 2109 "yuv_matrix", "yuv_adj", "ya_clamp_rect", "uv_clamp_rect", |
2110 "v_texture", | |
2111 "a_texture", | |
2112 "alpha", | |
2113 "cc_matrix", | |
enne (OOO)
2015/11/20 18:26:15
Oops!
| |
2114 "yuv_adj", | |
2115 "ya_clamp_rect", | |
2116 "uv_clamp_rect", | |
2117 }; | 2110 }; |
2118 int locations[arraysize(uniforms)]; | 2111 int locations[arraysize(uniforms)]; |
2119 | 2112 |
2120 GetProgramUniformLocations(context, | 2113 GetProgramUniformLocations(context, |
2121 program, | 2114 program, |
2122 arraysize(uniforms), | 2115 arraysize(uniforms), |
2123 uniforms, | 2116 uniforms, |
2124 locations, | 2117 locations, |
2125 base_uniform_index); | 2118 base_uniform_index); |
2126 y_texture_location_ = locations[0]; | 2119 y_texture_location_ = locations[0]; |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2252 void main() { | 2245 void main() { |
2253 vec4 d4 = min(edge_dist[0], edge_dist[1]); | 2246 vec4 d4 = min(edge_dist[0], edge_dist[1]); |
2254 vec2 d2 = min(d4.xz, d4.yw); | 2247 vec2 d2 = min(d4.xz, d4.yw); |
2255 float aa = clamp(gl_FragCoord.w * min(d2.x, d2.y), 0.0, 1.0); | 2248 float aa = clamp(gl_FragCoord.w * min(d2.x, d2.y), 0.0, 1.0); |
2256 gl_FragColor = color * aa; | 2249 gl_FragColor = color * aa; |
2257 } | 2250 } |
2258 }); | 2251 }); |
2259 } | 2252 } |
2260 | 2253 |
2261 } // namespace cc | 2254 } // namespace cc |
OLD | NEW |