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

Side by Side Diff: src/gpu/effects/GrMatrixConvolutionEffect.cpp

Issue 1862373003: Rename EmitArgs::fSamplers to fTexSamplers (Closed) Base URL: https://skia.googlesource.com/skia.git@upload3_infer
Patch Set: rebase Created 4 years, 8 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
« no previous file with comments | « src/gpu/effects/GrDistanceFieldGeoProc.cpp ('k') | src/gpu/effects/GrSimpleTextureEffect.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 #include "GrMatrixConvolutionEffect.h" 7 #include "GrMatrixConvolutionEffect.h"
8 #include "glsl/GrGLSLFragmentProcessor.h" 8 #include "glsl/GrGLSLFragmentProcessor.h"
9 #include "glsl/GrGLSLFragmentShaderBuilder.h" 9 #include "glsl/GrGLSLFragmentShaderBuilder.h"
10 #include "glsl/GrGLSLProgramDataManager.h" 10 #include "glsl/GrGLSLProgramDataManager.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 fragBuilder->codeAppendf("float k = %s[%d]%s;", kernel, offset / 4, 79 fragBuilder->codeAppendf("float k = %s[%d]%s;", kernel, offset / 4,
80 kVecSuffix[offset & 0x3]); 80 kVecSuffix[offset & 0x3]);
81 SkString coord; 81 SkString coord;
82 coord.printf("coord + vec2(%d, %d) * %s", x, y, imgInc); 82 coord.printf("coord + vec2(%d, %d) * %s", x, y, imgInc);
83 fDomain.sampleTexture(fragBuilder, 83 fDomain.sampleTexture(fragBuilder,
84 uniformHandler, 84 uniformHandler,
85 args.fGLSLCaps, 85 args.fGLSLCaps,
86 domain, 86 domain,
87 "c", 87 "c",
88 coord, 88 coord,
89 args.fSamplers[0]); 89 args.fTexSamplers[0]);
90 if (!mce.convolveAlpha()) { 90 if (!mce.convolveAlpha()) {
91 fragBuilder->codeAppend("c.rgb /= c.a;"); 91 fragBuilder->codeAppend("c.rgb /= c.a;");
92 fragBuilder->codeAppend("c.rgb = clamp(c.rgb, 0.0, 1.0);"); 92 fragBuilder->codeAppend("c.rgb = clamp(c.rgb, 0.0, 1.0);");
93 } 93 }
94 fragBuilder->codeAppend("sum += c * k;"); 94 fragBuilder->codeAppend("sum += c * k;");
95 } 95 }
96 } 96 }
97 if (mce.convolveAlpha()) { 97 if (mce.convolveAlpha()) {
98 fragBuilder->codeAppendf("%s = sum * %s + %s;", args.fOutputColor, gain, bias); 98 fragBuilder->codeAppendf("%s = sum * %s + %s;", args.fOutputColor, gain, bias);
99 fragBuilder->codeAppendf("%s.rgb = clamp(%s.rgb, 0.0, %s.a);", 99 fragBuilder->codeAppendf("%s.rgb = clamp(%s.rgb, 0.0, %s.a);",
100 args.fOutputColor, args.fOutputColor, args.fOut putColor); 100 args.fOutputColor, args.fOutputColor, args.fOut putColor);
101 } else { 101 } else {
102 fDomain.sampleTexture(fragBuilder, 102 fDomain.sampleTexture(fragBuilder,
103 uniformHandler, 103 uniformHandler,
104 args.fGLSLCaps, 104 args.fGLSLCaps,
105 domain, 105 domain,
106 "c", 106 "c",
107 coords2D, 107 coords2D,
108 args.fSamplers[0]); 108 args.fTexSamplers[0]);
109 fragBuilder->codeAppendf("%s.a = c.a;", args.fOutputColor); 109 fragBuilder->codeAppendf("%s.a = c.a;", args.fOutputColor);
110 fragBuilder->codeAppendf("%s.rgb = sum.rgb * %s + %s;", args.fOutputColo r, gain, bias); 110 fragBuilder->codeAppendf("%s.rgb = sum.rgb * %s + %s;", args.fOutputColo r, gain, bias);
111 fragBuilder->codeAppendf("%s.rgb *= %s.a;", args.fOutputColor, args.fOut putColor); 111 fragBuilder->codeAppendf("%s.rgb *= %s.a;", args.fOutputColor, args.fOut putColor);
112 } 112 }
113 113
114 SkString modulate; 114 SkString modulate;
115 GrGLSLMulVarBy4f(&modulate, args.fOutputColor, args.fInputColor); 115 GrGLSLMulVarBy4f(&modulate, args.fOutputColor, args.fInputColor);
116 fragBuilder->codeAppend(modulate.c_str()); 116 fragBuilder->codeAppend(modulate.c_str());
117 } 117 }
118 118
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 return GrMatrixConvolutionEffect::Create(d->fTextures[texIdx], 258 return GrMatrixConvolutionEffect::Create(d->fTextures[texIdx],
259 bounds, 259 bounds,
260 kernelSize, 260 kernelSize,
261 kernel.get(), 261 kernel.get(),
262 gain, 262 gain,
263 bias, 263 bias,
264 kernelOffset, 264 kernelOffset,
265 tileMode, 265 tileMode,
266 convolveAlpha); 266 convolveAlpha);
267 } 267 }
OLDNEW
« no previous file with comments | « src/gpu/effects/GrDistanceFieldGeoProc.cpp ('k') | src/gpu/effects/GrSimpleTextureEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698