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

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

Issue 1110033004: Make XPFragmentBuilder only Builder with access to DstCopy. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 7 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/GrDitherEffect.cpp ('k') | src/gpu/effects/GrOvalEffect.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 "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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 kFloat_GrSLType, kDefault_GrSLPrecision, "Bia s"); 67 kFloat_GrSLType, kDefault_GrSLPrecision, "Bia s");
68 68
69 const char* kernelOffset = builder->getUniformCStr(fKernelOffsetUni); 69 const char* kernelOffset = builder->getUniformCStr(fKernelOffsetUni);
70 const char* imgInc = builder->getUniformCStr(fImageIncrementUni); 70 const char* imgInc = builder->getUniformCStr(fImageIncrementUni);
71 const char* kernel = builder->getUniformCStr(fKernelUni); 71 const char* kernel = builder->getUniformCStr(fKernelUni);
72 const char* gain = builder->getUniformCStr(fGainUni); 72 const char* gain = builder->getUniformCStr(fGainUni);
73 const char* bias = builder->getUniformCStr(fBiasUni); 73 const char* bias = builder->getUniformCStr(fBiasUni);
74 int kWidth = fKernelSize.width(); 74 int kWidth = fKernelSize.width();
75 int kHeight = fKernelSize.height(); 75 int kHeight = fKernelSize.height();
76 76
77 GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder(); 77 GrGLFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder();
78 SkString coords2D = fsBuilder->ensureFSCoords2D(coords, 0); 78 SkString coords2D = fsBuilder->ensureFSCoords2D(coords, 0);
79 fsBuilder->codeAppend("vec4 sum = vec4(0, 0, 0, 0);"); 79 fsBuilder->codeAppend("vec4 sum = vec4(0, 0, 0, 0);");
80 fsBuilder->codeAppendf("vec2 coord = %s - %s * %s;", coords2D.c_str(), kerne lOffset, 80 fsBuilder->codeAppendf("vec2 coord = %s - %s * %s;", coords2D.c_str(), kerne lOffset,
81 imgInc); 81 imgInc);
82 fsBuilder->codeAppend("vec4 c;"); 82 fsBuilder->codeAppend("vec4 c;");
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);
(...skipping 175 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 | « src/gpu/effects/GrDitherEffect.cpp ('k') | src/gpu/effects/GrOvalEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698