Fix case where GrGLEffectMatrix gives back a dangling ptr for the coords var name.
R=robertphillips@google.com
Author: bsalomon@google.com
Review URL: https://chromiumcodereview.appspot.com/23706003
git-svn-id: http://skia.googlecode.com/svn/trunk@10982 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/effects/GrSimpleTextureEffect.cpp b/src/gpu/effects/GrSimpleTextureEffect.cpp
index 598c6ee..6a85e47 100644
--- a/src/gpu/effects/GrSimpleTextureEffect.cpp
+++ b/src/gpu/effects/GrSimpleTextureEffect.cpp
@@ -31,14 +31,16 @@
const char* inputColor,
const TextureSamplerArray& samplers) SK_OVERRIDE {
const GrSimpleTextureEffect& ste = drawEffect.castEffect<GrSimpleTextureEffect>();
- const char* fsCoordName;
+ SkString fsCoordName;
GrSLType fsCoordSLType;
if (GrEffect::kCustom_CoordsType == ste.coordsType()) {
SkASSERT(ste.getMatrix().isIdentity());
SkASSERT(1 == ste.numVertexAttribs());
fsCoordSLType = kVec2f_GrSLType;
const char* vsVaryingName;
- builder->addVarying(kVec2f_GrSLType, "textureCoords", &vsVaryingName, &fsCoordName);
+ const char* fsVaryingNamePtr;
+ builder->addVarying(kVec2f_GrSLType, "textureCoords", &vsVaryingName, &fsVaryingNamePtr);
+ fsCoordName = fsVaryingNamePtr;
const char* attrName =
builder->getEffectAttributeName(drawEffect.getVertexAttribIndices()[0])->c_str();
builder->vsCodeAppendf("\t%s = %s;\n", vsVaryingName, attrName);
@@ -49,7 +51,7 @@
builder->appendTextureLookupAndModulate(GrGLShaderBuilder::kFragment_ShaderType,
inputColor,
samplers[0],
- fsCoordName,
+ fsCoordName.c_str(),
fsCoordSLType);
builder->fsCodeAppend(";\n");
}