Index: src/sksl/SkSLGLSLCodeGenerator.cpp |
diff --git a/src/sksl/SkSLGLSLCodeGenerator.cpp b/src/sksl/SkSLGLSLCodeGenerator.cpp |
index 58cf7d3c36360622f9510a3254bcf403b5c43ee4..45644e8cd10032c12a824826a0073d4505d703af 100644 |
--- a/src/sksl/SkSLGLSLCodeGenerator.cpp |
+++ b/src/sksl/SkSLGLSLCodeGenerator.cpp |
@@ -163,6 +163,18 @@ void GLSLCodeGenerator::writeFunctionCall(const FunctionCall& c) { |
return; |
} |
} |
+ if (fCaps.fMustForceNegatedAtanParamToFloat && c.fFunction.fName == "atan" && |
+ c.fArguments.size() == 2 && c.fArguments[1]->fKind == Expression::kPrefix_Kind) { |
+ const PrefixExpression& p = (PrefixExpression&) *c.fArguments[1]; |
+ if (p.fOperator == Token::MINUS) { |
+ this->write("atan("); |
+ this->writeExpression(*c.fArguments[0], kSequence_Precedence); |
+ this->write(", -1.0 * "); |
+ this->writeExpression(*p.fOperand, kMultiplicative_Precedence); |
+ this->write(")"); |
+ return; |
+ } |
+ } |
this->write(c.fFunction.fName + "("); |
const char* separator = ""; |
for (const auto& arg : c.fArguments) { |