173 const int maxLen = 255;
177 if (*str == QLatin1Char(
'-')) {
180 }
else if (*str == QLatin1Char(
'+')) {
183 while (isDigit(str->unicode()) && pos < maxLen) {
184 temp[pos++] = str->toLatin1();
187 if (*str == QLatin1Char(
'.') && pos < maxLen) {
191 while (isDigit(str->unicode()) && pos < maxLen) {
192 temp[pos++] = str->toLatin1();
195 bool exponent =
false;
196 if ((*str == QLatin1Char(
'e') || *str == QLatin1Char(
'E')) && pos < maxLen) {
200 if ((*str == QLatin1Char(
'-') || *str == QLatin1Char(
'+')) && pos < maxLen) {
201 temp[pos++] = str->toLatin1();
204 while (isDigit(str->unicode()) && pos < maxLen) {
205 temp[pos++] = str->toLatin1();
213 if (!exponent && pos < 10) {
215 const char *t = temp;
221 while (*t && *t !=
'.') {
235 val = ((qreal)ival)/((qreal)div);
242 val = QByteArray::fromRawData(temp, pos).toDouble();
244 if (qFpClassify(
float(val)) != FP_NORMAL)
401 if (dataStr.isEmpty())
404 const int maxElementCount = 0x7fff;
405 qreal x0 = 0, y0 = 0;
409 const QChar *str = dataStr.constData();
410 const QChar *end = str + dataStr.size();
414 while (str->isSpace() && (str + 1) != end)
416 QChar pathElem = *str;
419 *
const_cast<QChar *>(end) = u'\0';
420 const char *pattern =
nullptr;
421 if (pathElem == QLatin1Char(
'a') || pathElem == QLatin1Char(
'A'))
423 QVarLengthArray<qreal, 8> arg;
424 parseNumbersArray(str, arg, pattern);
425 *
const_cast<QChar *>(end) = endc;
426 if (pathElem == QLatin1Char(
'z') || pathElem == QLatin1Char(
'Z'))
428 const qreal *num = arg.constData();
429 int count = arg.size();
433 switch (pathElem.unicode()) {
437 x = x0 = num[0] + offsetX;
438 y = y0 = num[1] + offsetY;
446 pathElem = QLatin1Char(
'l');
462 pathElem = QLatin1Char(
'L');
478 x = num[0] + offsetX;
479 y = num[1] + offsetY;
498 x = num[0] + offsetX;
512 y = num[0] + offsetY;
529 QPointF c1(num[0] + offsetX, num[1] + offsetY);
530 QPointF c2(num[2] + offsetX, num[3] + offsetY);
531 QPointF e(num[4] + offsetX, num[5] + offsetY);
534 path.cubicTo(c1, c2, e);
544 QPointF c1(num[0], num[1]);
545 QPointF c2(num[2], num[3]);
546 QPointF e(num[4], num[5]);
549 path.cubicTo(c1, c2, e);
560 if (lastMode ==
'c' || lastMode ==
'C' ||
561 lastMode ==
's' || lastMode ==
'S')
562 c1 = QPointF(2*x-ctrlPt.x(), 2*y-ctrlPt.y());
565 QPointF c2(num[0] + offsetX, num[1] + offsetY);
566 QPointF e(num[2] + offsetX, num[3] + offsetY);
569 path.cubicTo(c1, c2, e);
580 if (lastMode ==
'c' || lastMode ==
'C' ||
581 lastMode ==
's' || lastMode ==
'S')
582 c1 = QPointF(2*x-ctrlPt.x(), 2*y-ctrlPt.y());
585 QPointF c2(num[0], num[1]);
586 QPointF e(num[2], num[3]);
589 path.cubicTo(c1, c2, e);
599 QPointF c(num[0] + offsetX, num[1] + offsetY);
600 QPointF e(num[2] + offsetX, num[3] + offsetY);
613 QPointF c(num[0], num[1]);
614 QPointF e(num[2], num[3]);
627 QPointF e(num[0] + offsetX, num[1] + offsetY);
631 if (lastMode ==
'q' || lastMode ==
'Q' ||
632 lastMode ==
't' || lastMode ==
'T')
633 c = QPointF(2*x-ctrlPt.x(), 2*y-ctrlPt.y());
646 QPointF e(num[0], num[1]);
650 if (lastMode ==
'q' || lastMode ==
'Q' ||
651 lastMode ==
't' || lastMode ==
'T')
652 c = QPointF(2*x-ctrlPt.x(), 2*y-ctrlPt.y());
667 qreal xAxisRotation = (*num++);
668 qreal largeArcFlag = (*num++);
669 qreal sweepFlag = (*num++);
670 qreal ex = (*num++) + offsetX;
671 qreal ey = (*num++) + offsetY;
675 pathArc(path, rx, ry, xAxisRotation,
int(largeArcFlag),
676 int(sweepFlag), ex, ey, curx, cury);
688 qreal xAxisRotation = (*num++);
689 qreal largeArcFlag = (*num++);
690 qreal sweepFlag = (*num++);
696 pathArc(path, rx, ry, xAxisRotation,
int(largeArcFlag),
697 int(sweepFlag), ex, ey, curx, cury);
706 lastMode = pathElem.toLatin1();
707 if (limitLength && path.elementCount() > maxElementCount)