171 const int maxLen = 255;
175 if (*str == QLatin1Char(
'-')) {
178 }
else if (*str == QLatin1Char(
'+')) {
181 while (isDigit(str->unicode()) && pos < maxLen) {
182 temp[pos++] = str->toLatin1();
185 if (*str == QLatin1Char(
'.') && pos < maxLen) {
189 while (isDigit(str->unicode()) && pos < maxLen) {
190 temp[pos++] = str->toLatin1();
193 bool exponent =
false;
194 if ((*str == QLatin1Char(
'e') || *str == QLatin1Char(
'E')) && pos < maxLen) {
198 if ((*str == QLatin1Char(
'-') || *str == QLatin1Char(
'+')) && pos < maxLen) {
199 temp[pos++] = str->toLatin1();
202 while (isDigit(str->unicode()) && pos < maxLen) {
203 temp[pos++] = str->toLatin1();
211 if (!exponent && pos < 10) {
213 const char *t = temp;
219 while (*t && *t !=
'.') {
233 val = ((qreal)ival)/((qreal)div);
240 val = QByteArray::fromRawData(temp, pos).toDouble();
242 if (qFpClassify(
float(val)) != FP_NORMAL)
399 if (dataStr.isEmpty())
402 const int maxElementCount = 0x7fff;
403 qreal x0 = 0, y0 = 0;
407 const QChar *str = dataStr.constData();
408 const QChar *end = str + dataStr.size();
412 while (str->isSpace() && (str + 1) != end)
414 QChar pathElem = *str;
417 *
const_cast<QChar *>(end) = u'\0';
418 const char *pattern =
nullptr;
419 if (pathElem == QLatin1Char(
'a') || pathElem == QLatin1Char(
'A'))
421 QVarLengthArray<qreal, 8> arg;
422 parseNumbersArray(str, arg, pattern);
423 *
const_cast<QChar *>(end) = endc;
424 if (pathElem == QLatin1Char(
'z') || pathElem == QLatin1Char(
'Z'))
426 const qreal *num = arg.constData();
427 int count = arg.size();
431 switch (pathElem.unicode()) {
435 x = x0 = num[0] + offsetX;
436 y = y0 = num[1] + offsetY;
444 pathElem = QLatin1Char(
'l');
460 pathElem = QLatin1Char(
'L');
476 x = num[0] + offsetX;
477 y = num[1] + offsetY;
496 x = num[0] + offsetX;
510 y = num[0] + offsetY;
527 QPointF c1(num[0] + offsetX, num[1] + offsetY);
528 QPointF c2(num[2] + offsetX, num[3] + offsetY);
529 QPointF e(num[4] + offsetX, num[5] + offsetY);
532 path.cubicTo(c1, c2, e);
542 QPointF c1(num[0], num[1]);
543 QPointF c2(num[2], num[3]);
544 QPointF e(num[4], num[5]);
547 path.cubicTo(c1, c2, e);
558 if (lastMode ==
'c' || lastMode ==
'C' ||
559 lastMode ==
's' || lastMode ==
'S')
560 c1 = QPointF(2*x-ctrlPt.x(), 2*y-ctrlPt.y());
563 QPointF c2(num[0] + offsetX, num[1] + offsetY);
564 QPointF e(num[2] + offsetX, num[3] + offsetY);
567 path.cubicTo(c1, c2, e);
578 if (lastMode ==
'c' || lastMode ==
'C' ||
579 lastMode ==
's' || lastMode ==
'S')
580 c1 = QPointF(2*x-ctrlPt.x(), 2*y-ctrlPt.y());
583 QPointF c2(num[0], num[1]);
584 QPointF e(num[2], num[3]);
587 path.cubicTo(c1, c2, e);
597 QPointF c(num[0] + offsetX, num[1] + offsetY);
598 QPointF e(num[2] + offsetX, num[3] + offsetY);
611 QPointF c(num[0], num[1]);
612 QPointF e(num[2], num[3]);
625 QPointF e(num[0] + offsetX, num[1] + offsetY);
629 if (lastMode ==
'q' || lastMode ==
'Q' ||
630 lastMode ==
't' || lastMode ==
'T')
631 c = QPointF(2*x-ctrlPt.x(), 2*y-ctrlPt.y());
644 QPointF e(num[0], num[1]);
648 if (lastMode ==
'q' || lastMode ==
'Q' ||
649 lastMode ==
't' || lastMode ==
'T')
650 c = QPointF(2*x-ctrlPt.x(), 2*y-ctrlPt.y());
665 qreal xAxisRotation = (*num++);
666 qreal largeArcFlag = (*num++);
667 qreal sweepFlag = (*num++);
668 qreal ex = (*num++) + offsetX;
669 qreal ey = (*num++) + offsetY;
673 pathArc(path, rx, ry, xAxisRotation,
int(largeArcFlag),
674 int(sweepFlag), ex, ey, curx, cury);
686 qreal xAxisRotation = (*num++);
687 qreal largeArcFlag = (*num++);
688 qreal sweepFlag = (*num++);
694 pathArc(path, rx, ry, xAxisRotation,
int(largeArcFlag),
695 int(sweepFlag), ex, ey, curx, cury);
704 lastMode = pathElem.toLatin1();
705 if (limitLength && path.elementCount() > maxElementCount)