Recommit r5350 with fix for image failures (which affected GLs that don't support ARB_texture_swizzle).



git-svn-id: http://skia.googlecode.com/svn/trunk@5353 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/gl/GrGLShaderBuilder.cpp b/src/gpu/gl/GrGLShaderBuilder.cpp
index c061468..5d870dd 100644
--- a/src/gpu/gl/GrGLShaderBuilder.cpp
+++ b/src/gpu/gl/GrGLShaderBuilder.cpp
@@ -96,14 +96,6 @@
     }
 }
 
-void GrGLShaderBuilder::computeModulate(const char* fsInColor) {
-    if (NULL != fsInColor) {
-        fModulate.printf(" * %s", fsInColor);
-    } else {
-        fModulate.reset();
-    }
-}
-
 void GrGLShaderBuilder::setupTextureAccess(const char* varyingFSName, GrSLType varyingType) {
     // FIXME: We don't know how the custom stage will manipulate the coords. So we give up on using
     // projective texturing and always give the stage 2D coords. This will be fixed when custom
@@ -130,23 +122,27 @@
     }
 }
 
-void GrGLShaderBuilder::emitTextureLookup(const char* samplerName,
-                                          const char* coordName,
-                                          GrSLType varyingType) {
+void GrGLShaderBuilder::appendTextureLookup(SkString* out,
+                                            const char* samplerName,
+                                            const char* coordName,
+                                            GrSLType varyingType) const {
     if (NULL == coordName) {
         coordName = fDefaultTexCoordsName.c_str();
         varyingType = kVec2f_GrSLType;
     }
-    fFSCode.appendf("%s(%s, %s)", sample_function_name(varyingType), samplerName, coordName);
+    out->appendf("%s(%s, %s)", sample_function_name(varyingType), samplerName, coordName);
 }
 
-void GrGLShaderBuilder::emitTextureLookupAndModulate(const char* outColor,
-                                                     const char* samplerName,
-                                                     const char* coordName,
-                                                     GrSLType varyingType) {
-    fFSCode.appendf("\t%s = ", outColor);
-    this->emitTextureLookup(samplerName, coordName, varyingType);
-    fFSCode.appendf("%s%s;\n", fSwizzle.c_str(), fModulate.c_str());
+void GrGLShaderBuilder::appendTextureLookupAndModulate(SkString* out,
+                                                       const char* modulation,
+                                                       const char* samplerName,
+                                                       const char* coordName,
+                                                       GrSLType varyingType) const {
+    GrAssert(NULL != out);
+    SkString lookup;
+    this->appendTextureLookup(&lookup, samplerName, coordName, varyingType);
+    lookup.append(fSwizzle.c_str());
+    GrGLSLModulate4f(out, modulation, lookup.c_str());
 }
 
 void GrGLShaderBuilder::emitCustomTextureLookup(const GrTextureAccess& textureAccess,