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

Side by Side Diff: cc/output/shader.cc

Issue 812543002: Update from https://crrev.com/308331 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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
« no previous file with comments | « cc/output/renderer_pixeltest.cc ('k') | cc/output/software_renderer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "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 677 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 if (shader_string.find("ApplyBlendMode") == std::string::npos) 688 if (shader_string.find("ApplyBlendMode") == std::string::npos)
689 return shader_string; 689 return shader_string;
690 690
691 if (!has_blend_mode()) { 691 if (!has_blend_mode()) {
692 return "#define ApplyBlendMode(X) (X)\n" + shader_string; 692 return "#define ApplyBlendMode(X) (X)\n" + shader_string;
693 } 693 }
694 694
695 // clang-format off 695 // clang-format off
696 static const std::string kFunctionApplyBlendMode = SHADER0( 696 static const std::string kFunctionApplyBlendMode = SHADER0(
697 // clang-format on 697 // clang-format on
698 uniform SamplerType s_backdropTexture; 698 uniform sampler2D s_backdropTexture;
699 uniform TexCoordPrecision vec4 backdropRect; 699 uniform TexCoordPrecision vec4 backdropRect;
700 700
701 vec4 GetBackdropColor() { 701 vec4 GetBackdropColor() {
702 TexCoordPrecision vec2 bgTexCoord = gl_FragCoord.xy - backdropRect.xy; 702 TexCoordPrecision vec2 bgTexCoord = gl_FragCoord.xy - backdropRect.xy;
703 bgTexCoord.x /= backdropRect.z; 703 bgTexCoord.x /= backdropRect.z;
704 bgTexCoord.y /= backdropRect.w; 704 bgTexCoord.y /= backdropRect.w;
705 return TextureLookup(s_backdropTexture, bgTexCoord); 705 return texture2D(s_backdropTexture, bgTexCoord);
706 } 706 }
707 707
708 vec4 ApplyBlendMode(vec4 src) { 708 vec4 ApplyBlendMode(vec4 src) {
709 vec4 dst = GetBackdropColor(); 709 vec4 dst = GetBackdropColor();
710 return Blend(src, dst); 710 return Blend(src, dst);
711 } 711 }
712 // clang-format off 712 // clang-format off
713 ); // NOLINT(whitespace/parens) 713 ); // NOLINT(whitespace/parens)
714 // clang-format on 714 // clang-format on
715 715
(...skipping 1268 matching lines...) Expand 10 before | Expand all | Expand 10 after
1984 vec2 coord = mod(floor(texCoord * frequency * 2.0), 2.0); 1984 vec2 coord = mod(floor(texCoord * frequency * 2.0), 2.0);
1985 float picker = abs(coord.x - coord.y); // NOLINT 1985 float picker = abs(coord.x - coord.y); // NOLINT
1986 gl_FragColor = mix(color1, color2, picker) * alpha; 1986 gl_FragColor = mix(color1, color2, picker) * alpha;
1987 } 1987 }
1988 // clang-format off 1988 // clang-format off
1989 ); // NOLINT(whitespace/parens) 1989 ); // NOLINT(whitespace/parens)
1990 // clang-format on 1990 // clang-format on
1991 } 1991 }
1992 1992
1993 } // namespace cc 1993 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/renderer_pixeltest.cc ('k') | cc/output/software_renderer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698