* @brief Emits a symmetric four-vertex cross-section along unit normal n at half-width hw: feather * edge, core edge, core edge, feather edge. The feather adds kFeatherPx beyond the core, so * the 50%-alpha point lands on the stroke edge and the alpha ramp anti-aliases. Used at run * ends (flat caps) where both sides are exposed. */
| 93 | * ends (flat caps) where both sides are exposed. |
| 94 | */ |
| 95 | static void emitCapSection(QSGGeometry::ColoredPoint2D* vertices, |
| 96 | int& v, |
| 97 | const QPointF& p, |
| 98 | const QPointF& n, |
| 99 | const double hw, |
| 100 | const QColor& color) |
| 101 | { |
| 102 | Q_ASSERT(vertices != nullptr); |
| 103 | Q_ASSERT(hw > 0.0); |
| 104 | |
| 105 | const double alpha = color.alphaF(); |
| 106 | const double face = std::max(0.25, hw - kFeatherPx * 0.5); |
| 107 | const double edge = face + kFeatherPx; |
| 108 | |
| 109 | setVertexColor(vertices[v++], |
| 110 | static_cast<float>(p.x() + n.x() * edge), |
| 111 | static_cast<float>(p.y() + n.y() * edge), |
| 112 | color, |
| 113 | 0.0); |
| 114 | setVertexColor(vertices[v++], |
| 115 | static_cast<float>(p.x() + n.x() * face), |
| 116 | static_cast<float>(p.y() + n.y() * face), |
| 117 | color, |
| 118 | alpha); |
| 119 | setVertexColor(vertices[v++], |
| 120 | static_cast<float>(p.x() - n.x() * face), |
| 121 | static_cast<float>(p.y() - n.y() * face), |
| 122 | color, |
| 123 | alpha); |
| 124 | setVertexColor(vertices[v++], |
| 125 | static_cast<float>(p.x() - n.x() * edge), |
| 126 | static_cast<float>(p.y() - n.y() * edge), |
| 127 | color, |
| 128 | 0.0); |
| 129 | } |
| 130 | |
| 131 | /** |
| 132 | * @brief Emits a round-join fan filling the outer notch at vertex p, sweeping outer-side unit |
no test coverage detected