52 const QPointF*
const points =
reinterpret_cast<
const QPointF*>(path.points());
53 const QPainterPath::ElementType*
const elements = path.elements();
55 if (boundingRectDirty) {
56 minX = maxX = points[0].x();
57 minY = maxY = points[0].y();
58 boundingRectDirty =
false;
61 if (!outline && !path.isConvex())
64 int lastMoveTo = vertexArray.size();
65 vertexArray.add(points[0]);
72 for (
int i=1; i<path.elementCount(); ++i)
73 lineToArray(points[i].x(), points[i].y());
79 for (
int i=1; i<path.elementCount(); ++i) {
80 switch (elements[i]) {
81 case QPainterPath::MoveToElement:
83 addClosingLine(lastMoveTo);
85 vertexArrayStops.add(vertexArray.size());
87 if (!path.isConvex()) addCentroid(path, i);
88 lastMoveTo = vertexArray.size();
90 lineToArray(points[i].x(), points[i].y());
92 case QPainterPath::LineToElement:
94 lineToArray(points[i].x(), points[i].y());
96 case QPainterPath::CurveToElement: {
97 QBezier b = QBezier::fromPoints(*(((
const QPointF *) points) + i - 1),
101 QRectF bounds = b.bounds();
103 int threshold = qMin<
float>(64, qMax(bounds.width(), bounds.height()) * 3.14f / (curveInverseScale * 6));
104 if (threshold < 3) threshold = 3;
105 qreal one_over_threshold_minus_1 = qreal(1) / (threshold - 1);
106 for (
int t=0; t<threshold; ++t) {
107 QPointF pt = b.pointAt(t * one_over_threshold_minus_1);
108 lineToArray(pt.x(), pt.y());
119 addClosingLine(lastMoveTo);
120 vertexArrayStops.add(vertexArray.size());