92 const auto*
const points =
reinterpret_cast<const QPointF*
>(path.points());
93 const QPainterPath::ElementType*
const elements = path.elements();
95 if (boundingRectDirty) {
96 minX = maxX =
static_cast<float>(points[0].x());
97 minY = maxY =
static_cast<float>(points[0].y());
98 boundingRectDirty =
false;
101 if (!outline && !path.isConvex())
102 addCentroid(path, 0);
104 int lastMoveTo =
static_cast<int>(vertexArray.size());
112 for (
int i=1; i<path.elementCount(); ++i) {
120 for (
int i=1; i<path.elementCount(); ++i) {
121 switch (elements[i]) {
122 case QPainterPath::MoveToElement:
124 addClosingLine(lastMoveTo);
126 vertexArrayStops.add(
static_cast<int>(vertexArray.size()));
128 if (!path.isConvex()) {
129 addCentroid(path, i);
131 lastMoveTo =
static_cast<int>(vertexArray.size());
135 case QPainterPath::LineToElement:
139 case QPainterPath::CurveToElement: {
140 const QBezier b = QBezier::fromPoints(*(
static_cast<const QPointF *
>(points) + i - 1),
144 const QRectF bounds = b.bounds();
147 int threshold = qMin<float>(64, qMax(bounds.width(), bounds.height()) * 3.14F / (curveInverseScale * 6));
148 threshold = std::max(threshold, 3);
149 const qreal one_over_threshold_minus_1 = qreal(1) / (threshold - 1);
150 for (
int t=0; t<threshold; ++t) {
151 const QPointF pt = b.pointAt(t * one_over_threshold_minus_1);
163 addClosingLine(lastMoveTo);
164 vertexArrayStops.add(
static_cast<int>(vertexArray.size()));