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

Unified Diff: src/effects/SkMatrixConvolutionImageFilter.cpp

Issue 23706003: Fix case where GrGLEffectMatrix gives back a dangling ptr for the coords var name. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Rob's comments Created 7 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/effects/SkMagnifierImageFilter.cpp ('k') | src/effects/SkMorphologyImageFilter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/SkMatrixConvolutionImageFilter.cpp
diff --git a/src/effects/SkMatrixConvolutionImageFilter.cpp b/src/effects/SkMatrixConvolutionImageFilter.cpp
index 37ca2fa141cae500dc19809c28ecd1e2dc6273ae..00bb6ec4bb474166f5ad7e62b69a72b83868e5ec 100644
--- a/src/effects/SkMatrixConvolutionImageFilter.cpp
+++ b/src/effects/SkMatrixConvolutionImageFilter.cpp
@@ -385,7 +385,7 @@ void GrGLMatrixConvolutionEffect::emitCode(GrGLShaderBuilder* builder,
const char* outputColor,
const char* inputColor,
const TextureSamplerArray& samplers) {
- const char* coords;
+ SkString coords;
fEffectMatrix.emitCodeMakeFSCoords2D(builder, key, &coords);
fImageIncrementUni = builder->addUniform(GrGLShaderBuilder::kFragment_ShaderType,
kVec2f_GrSLType, "ImageIncrement");
@@ -407,7 +407,7 @@ void GrGLMatrixConvolutionEffect::emitCode(GrGLShaderBuilder* builder,
int kHeight = fKernelSize.height();
builder->fsCodeAppend("\t\tvec4 sum = vec4(0, 0, 0, 0);\n");
- builder->fsCodeAppendf("\t\tvec2 coord = %s - %s * %s;\n", coords, target, imgInc);
+ builder->fsCodeAppendf("\t\tvec2 coord = %s - %s * %s;\n", coords.c_str(), target, imgInc);
builder->fsCodeAppendf("\t\tfor (int y = 0; y < %d; y++) {\n", kHeight);
builder->fsCodeAppendf("\t\t\tfor (int x = 0; x < %d; x++) {\n", kWidth);
builder->fsCodeAppendf("\t\t\t\tfloat k = %s[y * %d + x];\n", kernel, kWidth);
@@ -426,7 +426,7 @@ void GrGLMatrixConvolutionEffect::emitCode(GrGLShaderBuilder* builder,
builder->fsCodeAppendf("\t\t%s.rgb = clamp(%s.rgb, 0.0, %s.a);\n", outputColor, outputColor, outputColor);
} else {
builder->fsCodeAppend("\t\tvec4 c = ");
- appendTextureLookup(builder, samplers[0], coords, fTileMode);
+ appendTextureLookup(builder, samplers[0], coords.c_str(), fTileMode);
builder->fsCodeAppend(";\n");
builder->fsCodeAppendf("\t\t%s.a = c.a;\n", outputColor);
builder->fsCodeAppendf("\t\t%s.rgb = sum.rgb * %s + %s;\n", outputColor, gain, bias);
« no previous file with comments | « src/effects/SkMagnifierImageFilter.cpp ('k') | src/effects/SkMorphologyImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698