48void QQuickGenerator::optimizePaths(
const PathNodeInfo &info,
const QRectF &overrideBoundingRect)
50 QPainterPath pathCopy = info.painterPath;
51 pathCopy.setFillRule(info.fillRule);
53 const QRectF &boundingRect = overrideBoundingRect.isNull() ? pathCopy.boundingRect() : overrideBoundingRect;
54 if (m_flags.testFlag(QQuickVectorImageGenerator::GeneratorFlag::OptimizePaths)) {
55 QQuadPath strokePath = QQuadPath::fromPainterPath(pathCopy);
56 bool fillPathNeededClose;
57 QQuadPath fillPath = strokePath.subPathsClosed(&fillPathNeededClose);
58 const bool intersectionsFound = QSGCurveProcessor::solveIntersections(fillPath,
false);
59 fillPath.addCurvatureData();
60 QSGCurveProcessor::solveOverlaps(fillPath);
61 const bool compatibleStrokeAndFill = !fillPathNeededClose && !intersectionsFound;
63 if (compatibleStrokeAndFill || m_flags.testFlag(QQuickVectorImageGenerator::GeneratorFlag::OutlineStrokeMode)) {
64 outputShapePath(info,
nullptr, &fillPath, QQuickVectorImageGenerator::FillAndStroke, boundingRect);
66 outputShapePath(info,
nullptr, &fillPath, QQuickVectorImageGenerator::FillPath, boundingRect);
67 outputShapePath(info,
nullptr, &strokePath, QQuickVectorImageGenerator::StrokePath, boundingRect);
70 outputShapePath(info, &pathCopy,
nullptr, QQuickVectorImageGenerator::FillAndStroke, boundingRect);