Index: src/gpu/gl/GrGLSL.cpp |
diff --git a/src/gpu/gl/GrGLSL.cpp b/src/gpu/gl/GrGLSL.cpp |
index f48f03854647ad2dc2369bdbb2a4f74892d0458e..9cddd7ec5d3603f121041052cf92ca4d8a3d8597 100644 |
--- a/src/gpu/gl/GrGLSL.cpp |
+++ b/src/gpu/gl/GrGLSL.cpp |
@@ -94,50 +94,19 @@ namespace { |
} |
} |
-GrSLConstantVec GrGLSLMulVarBy4f(SkString* outAppend, |
- int tabCnt, |
- const char* vec4VarName, |
- const char* mulFactor, |
- GrSLConstantVec mulFactorDefault) { |
- bool haveFactor = NULL != mulFactor && '\0' != *mulFactor; |
- |
- SkASSERT(NULL != outAppend); |
- SkASSERT(NULL != vec4VarName); |
- SkASSERT(kNone_GrSLConstantVec != mulFactorDefault || haveFactor); |
- |
- if (!haveFactor) { |
- if (kOnes_GrSLConstantVec == mulFactorDefault) { |
- return kNone_GrSLConstantVec; |
- } else { |
- SkASSERT(kZeros_GrSLConstantVec == mulFactorDefault); |
- append_tabs(outAppend, tabCnt); |
- outAppend->appendf("%s = vec4(0, 0, 0, 0);\n", vec4VarName); |
- return kZeros_GrSLConstantVec; |
- } |
+void GrGLSLMulVarBy4f(SkString* outAppend, |
+ unsigned tabCnt, |
+ const char* vec4VarName, |
+ const GrGLSLExpr<4>& mulFactor) { |
+ if (mulFactor.isOnes()) { |
+ *outAppend = SkString(); |
} |
+ |
append_tabs(outAppend, tabCnt); |
- outAppend->appendf("%s *= %s;\n", vec4VarName, mulFactor); |
- return kNone_GrSLConstantVec; |
-} |
-GrSLConstantVec GrGLSLGetComponent4f(SkString* outAppend, |
- const char* expr, |
- GrColorComponentFlags component, |
- GrSLConstantVec defaultExpr, |
- bool omitIfConst) { |
- if (NULL == expr || '\0' == *expr) { |
- SkASSERT(defaultExpr != kNone_GrSLConstantVec); |
- if (!omitIfConst) { |
- if (kOnes_GrSLConstantVec == defaultExpr) { |
- outAppend->append("1.0"); |
- } else { |
- SkASSERT(kZeros_GrSLConstantVec == defaultExpr); |
- outAppend->append("0.0"); |
- } |
- } |
- return defaultExpr; |
- } else { |
- outAppend->appendf("(%s).%c", expr, GrColorComponentFlagToChar(component)); |
- return kNone_GrSLConstantVec; |
+ if (mulFactor.isZeros()) { |
+ outAppend->appendf("%s = vec4(0);\n", vec4VarName); |
} |
+ outAppend->appendf("%s *= %s;\n", vec4VarName, mulFactor.c_str()); |
} |
+ |