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

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

Issue 1056713002: Revert of Fix GLSL error on Android. (Closed) Base URL: https://skia.googlesource.com/skia.git@filters-use-scratch-textures
Patch Set: Created 5 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 | « no previous file | no next file » | 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 "gl/GrGLProcessor.h" 8 #include "gl/GrGLProcessor.h"
9 #include "gl/GrGLSL.h" 9 #include "gl/GrGLSL.h"
10 #include "gl/GrGLTexture.h" 10 #include "gl/GrGLTexture.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 83
84 for (int y = 0; y < kHeight; y++) { 84 for (int y = 0; y < kHeight; y++) {
85 for (int x = 0; x < kWidth; x++) { 85 for (int x = 0; x < kWidth; x++) {
86 GrGLShaderBuilder::ShaderBlock block(fsBuilder); 86 GrGLShaderBuilder::ShaderBlock block(fsBuilder);
87 fsBuilder->codeAppendf("float k = %s[%d * %d + %d];", kernel, y, kWi dth, x); 87 fsBuilder->codeAppendf("float k = %s[%d * %d + %d];", kernel, y, kWi dth, x);
88 SkString coord; 88 SkString coord;
89 coord.printf("coord + vec2(%d, %d) * %s", x, y, imgInc); 89 coord.printf("coord + vec2(%d, %d) * %s", x, y, imgInc);
90 fDomain.sampleTexture(fsBuilder, domain, "c", coord, samplers[0]); 90 fDomain.sampleTexture(fsBuilder, domain, "c", coord, samplers[0]);
91 if (!fConvolveAlpha) { 91 if (!fConvolveAlpha) {
92 fsBuilder->codeAppend("c.rgb /= c.a;"); 92 fsBuilder->codeAppend("c.rgb /= c.a;");
93 fsBuilder->codeAppend("c.rgb = clamp(c.rgb, 0.0, 1.0);"); 93 fsBuilder->codeAppend("c.rgb = clamp(c.rgb, 0, 1);");
94 } 94 }
95 fsBuilder->codeAppend("sum += c * k;"); 95 fsBuilder->codeAppend("sum += c * k;");
96 } 96 }
97 } 97 }
98 if (fConvolveAlpha) { 98 if (fConvolveAlpha) {
99 fsBuilder->codeAppendf("%s = sum * %s + %s;", outputColor, gain, bias); 99 fsBuilder->codeAppendf("%s = sum * %s + %s;", outputColor, gain, bias);
100 fsBuilder->codeAppendf("%s.rgb = clamp(%s.rgb, 0.0, %s.a);", 100 fsBuilder->codeAppendf("%s.rgb = clamp(%s.rgb, 0.0, %s.a);",
101 outputColor, outputColor, outputColor); 101 outputColor, outputColor, outputColor);
102 } else { 102 } else {
103 fDomain.sampleTexture(fsBuilder, domain, "c", coords2D, samplers[0]); 103 fDomain.sampleTexture(fsBuilder, domain, "c", coords2D, samplers[0]);
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 return GrMatrixConvolutionEffect::Create(textures[texIdx], 263 return GrMatrixConvolutionEffect::Create(textures[texIdx],
264 bounds, 264 bounds,
265 kernelSize, 265 kernelSize,
266 kernel.get(), 266 kernel.get(),
267 gain, 267 gain,
268 bias, 268 bias,
269 kernelOffset, 269 kernelOffset,
270 tileMode, 270 tileMode,
271 convolveAlpha); 271 convolveAlpha);
272 } 272 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698