Add clang-format (#1086)

Co-authored-by: mwilsnd <mwilsnd@gmail.com>
This commit is contained in:
Bart Louwers
2023-05-01 16:57:37 +02:00
committed by GitHub
parent 403a12bd1b
commit 71f6da2722
1018 changed files with 27876 additions and 25862 deletions

View File

@@ -6,30 +6,21 @@ namespace style {
namespace expression {
std::string stringifyColor(double r, double g, double b, double a) {
return stringify(r) + ", " +
stringify(g) + ", " +
stringify(b) + ", " +
stringify(a);
return stringify(r) + ", " + stringify(g) + ", " + stringify(b) + ", " + stringify(a);
}
Result<Color> rgba(double r, double g, double b, double a) {
if (
r < 0 || r > 255 ||
g < 0 || g > 255 ||
b < 0 || b > 255
) {
return EvaluationError {
"Invalid rgba value [" + stringifyColor(r, g, b, a) +
"]: 'r', 'g', and 'b' must be between 0 and 255."
};
if (r < 0 || r > 255 || g < 0 || g > 255 || b < 0 || b > 255) {
return EvaluationError{"Invalid rgba value [" + stringifyColor(r, g, b, a) +
"]: 'r', 'g', and 'b' must be between 0 and 255."};
}
if (a < 0 || a > 1) {
return EvaluationError {
"Invalid rgba value [" + stringifyColor(r, g, b, a) +
"]: 'a' must be between 0 and 1."
};
return EvaluationError{"Invalid rgba value [" + stringifyColor(r, g, b, a) + "]: 'a' must be between 0 and 1."};
}
return Color(static_cast<float>(r / 255 * a), static_cast<float>(g / 255 * a), static_cast<float>(b / 255 * a), static_cast<float>(a));
return Color(static_cast<float>(r / 255 * a),
static_cast<float>(g / 255 * a),
static_cast<float>(b / 255 * a),
static_cast<float>(a));
}
} // namespace expression