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/gl/GrGLEffectMatrix.cpp b/src/gpu/gl/GrGLEffectMatrix.cpp
index 8c8dcce..58fcfea 100644
--- a/src/gpu/gl/GrGLEffectMatrix.cpp
+++ b/src/gpu/gl/GrGLEffectMatrix.cpp
@@ -45,8 +45,8 @@
GrSLType GrGLEffectMatrix::emitCode(GrGLShaderBuilder* builder,
EffectKey key,
- const char** fsCoordName,
- const char** vsCoordName,
+ SkString* fsCoordName,
+ SkString* vsCoordName,
const char* suffix) {
GrSLType varyingType = kVoid_GrSLType;
const char* uniName;
@@ -152,11 +152,11 @@
*/
void GrGLEffectMatrix::emitCodeMakeFSCoords2D(GrGLShaderBuilder* builder,
EffectKey key,
- const char** fsCoordName,
- const char** vsVaryingName,
+ SkString* fsCoordName,
+ SkString* vsVaryingName,
GrSLType* vsVaryingType,
const char* suffix) {
- const char* fsVaryingName;
+ SkString fsVaryingName;
GrSLType varyingType = this->emitCode(builder,
key,
@@ -173,7 +173,7 @@
coordName = suffixedCoordName.c_str();
}
builder->fsCodeAppendf("\tvec2 %s = %s.xy / %s.z;",
- coordName, fsVaryingName, fsVaryingName);
+ coordName, fsVaryingName.c_str(), fsVaryingName.c_str());
if (NULL != fsCoordName) {
*fsCoordName = coordName;
}
diff --git a/src/gpu/gl/GrGLEffectMatrix.h b/src/gpu/gl/GrGLEffectMatrix.h
index 974e001..56dda45 100644
--- a/src/gpu/gl/GrGLEffectMatrix.h
+++ b/src/gpu/gl/GrGLEffectMatrix.h
@@ -84,12 +84,12 @@
* are returned as output parameters and the type of the varying is the return value. The suffix
* is an optional parameter that can be used to make all variables emitted by the object
* unique within a stage. It is only necessary if multiple GrGLEffectMatrix objects are used by
- * a GrGLEffect.
+ * a single GrGLEffect.
*/
GrSLType emitCode(GrGLShaderBuilder*,
EffectKey,
- const char** fsCoordName, /* optional */
- const char** vsCoordName = NULL,
+ SkString* fsCoordName, /* optional */
+ SkString* vsCoordName = NULL,
const char* suffix = NULL);
/**
@@ -98,8 +98,8 @@
*/
void emitCodeMakeFSCoords2D(GrGLShaderBuilder*,
EffectKey,
- const char** fsCoordName, /* optional */
- const char** vsVaryingName = NULL,
+ SkString* fsCoordName, /* optional */
+ SkString* vsVaryingName = NULL,
GrSLType* vsVaryingType = NULL,
const char* suffix = NULL);
/**