// Makes a literal of $floatLiteral type. static std::unique_ptr<Literal> MakeFloat(const Context& context, Position pos, floatvalue) { return std::make_unique<Literal>(pos, value, context.fTypes.fFloatLiteral.get());
}
// Makes a float literal of the specified type. static std::unique_ptr<Literal> MakeFloat(Position pos, float value, const Type* type) {
SkASSERT(type->isFloat()); return std::make_unique<Literal>(pos, value, type);
}
// Makes a literal of $intLiteral type. static std::unique_ptr<Literal> MakeInt(const Context& context, Position pos, SKSL_INT value) { return std::make_unique<Literal>(pos, value, context.fTypes.fIntLiteral.get());
}
// Makes an int literal of the specified type. static std::unique_ptr<Literal> MakeInt(Position pos, SKSL_INT value, const Type* type) {
SkASSERT(type->isInteger());
SkASSERTF(value >= type->minimumValue(), "Value %" PRId64 " does not fit in type %s",
value, type->description().c_str());
SkASSERTF(value <= type->maximumValue(), "Value %" PRId64 " does not fit in type %s",
value, type->description().c_str()); return std::make_unique<Literal>(pos, value, type);
}
// Makes a literal of boolean type. static std::unique_ptr<Literal> MakeBool(const Context& context, Position pos, bool value) { return std::make_unique<Literal>(pos, value, context.fTypes.fBool.get());
}
// Makes a literal of boolean type. (Functionally identical to the above, but useful if you // don't have access to the Context.) static std::unique_ptr<Literal> MakeBool(Position pos, bool value, const Type* type) {
SkASSERT(type->isBoolean()); return std::make_unique<Literal>(pos, value, type);
}
// Makes a literal of the specified type, rounding as needed. static std::unique_ptr<Literal> Make(Position pos, double value, const Type* type) { if (type->isFloat()) { return MakeFloat(pos, value, type);
} if (type->isInteger()) { return MakeInt(pos, value, type);
}
SkASSERT(type->isBoolean()); return MakeBool(pos, value, type);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.