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 754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
765 | 765 |
766 FragmentTexBlendMode::FragmentTexBlendMode() | 766 FragmentTexBlendMode::FragmentTexBlendMode() |
767 : backdrop_location_(-1), | 767 : backdrop_location_(-1), |
768 original_backdrop_location_(-1), | 768 original_backdrop_location_(-1), |
769 backdrop_rect_location_(-1), | 769 backdrop_rect_location_(-1), |
770 blend_mode_(BLEND_MODE_NONE), | 770 blend_mode_(BLEND_MODE_NONE), |
771 mask_for_background_(false) { | 771 mask_for_background_(false) { |
772 } | 772 } |
773 | 773 |
774 std::string FragmentTexBlendMode::SetBlendModeFunctions( | 774 std::string FragmentTexBlendMode::SetBlendModeFunctions( |
775 std::string shader_string) const { | 775 const std::string& shader_string) const { |
776 if (shader_string.find("ApplyBlendMode") == std::string::npos) | 776 if (shader_string.find("ApplyBlendMode") == std::string::npos) |
777 return shader_string; | 777 return shader_string; |
778 | 778 |
779 if (!has_blend_mode()) { | 779 if (!has_blend_mode()) { |
780 return "#define ApplyBlendMode(X, Y) (X)\n" + shader_string; | 780 return "#define ApplyBlendMode(X, Y) (X)\n" + shader_string; |
781 } | 781 } |
782 | 782 |
783 static const std::string kUniforms = SHADER0([]() { | 783 static const std::string kUniforms = SHADER0([]() { |
784 uniform sampler2D s_backdropTexture; | 784 uniform sampler2D s_backdropTexture; |
785 uniform sampler2D s_originalBackdropTexture; | 785 uniform sampler2D s_originalBackdropTexture; |
(...skipping 1461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2247 void main() { | 2247 void main() { |
2248 vec4 d4 = min(edge_dist[0], edge_dist[1]); | 2248 vec4 d4 = min(edge_dist[0], edge_dist[1]); |
2249 vec2 d2 = min(d4.xz, d4.yw); | 2249 vec2 d2 = min(d4.xz, d4.yw); |
2250 float aa = clamp(gl_FragCoord.w * min(d2.x, d2.y), 0.0, 1.0); | 2250 float aa = clamp(gl_FragCoord.w * min(d2.x, d2.y), 0.0, 1.0); |
2251 gl_FragColor = color * aa; | 2251 gl_FragColor = color * aa; |
2252 } | 2252 } |
2253 }); | 2253 }); |
2254 } | 2254 } |
2255 | 2255 |
2256 } // namespace cc | 2256 } // namespace cc |
OLD | NEW |