MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / setVertexColor

Function setVertexColor

app/src/UI/Widgets/PlotAreaFill.cpp:41–56  ·  view source on GitHub ↗

* @brief Encodes a premultiplied vertex color for QSGVertexColorMaterial. */

Source from the content-addressed store, hash-verified

39 * @brief Encodes a premultiplied vertex color for QSGVertexColorMaterial.
40 */
41static void setVertexColor(QSGGeometry::ColoredPoint2D& vertex,
42 const float x,
43 const float y,
44 const QColor& color,
45 const double alpha)
46{
47 Q_ASSERT(alpha >= 0.0);
48 Q_ASSERT(alpha <= 1.0);
49
50 vertex.set(x,
51 y,
52 static_cast<unsigned char>(std::lround(color.redF() * alpha * 255.0)),
53 static_cast<unsigned char>(std::lround(color.greenF() * alpha * 255.0)),
54 static_cast<unsigned char>(std::lround(color.blueF() * alpha * 255.0)),
55 static_cast<unsigned char>(std::lround(alpha * 255.0)));
56}
57
58/**
59 * @brief Constructs the fill item and enables scene-graph content.

Callers 1

emitColumnsMethod · 0.70

Calls 2

lroundFunction · 0.85
setMethod · 0.45

Tested by

no test coverage detected