equal
deleted
inserted
replaced
1145 matrix.scale(sx, sy); |
1145 matrix.scale(sx, sy); |
1146 } else if (state == SkewX) { |
1146 } else if (state == SkewX) { |
1147 if (points.count() != 1) |
1147 if (points.count() != 1) |
1148 goto error; |
1148 goto error; |
1149 const qreal deg2rad = qreal(0.017453292519943295769); |
1149 const qreal deg2rad = qreal(0.017453292519943295769); |
1150 matrix.shear(tan(points[0]*deg2rad), 0); |
1150 matrix.shear(qTan(points[0]*deg2rad), 0); |
1151 } else if (state == SkewY) { |
1151 } else if (state == SkewY) { |
1152 if (points.count() != 1) |
1152 if (points.count() != 1) |
1153 goto error; |
1153 goto error; |
1154 const qreal deg2rad = qreal(0.017453292519943295769); |
1154 const qreal deg2rad = qreal(0.017453292519943295769); |
1155 matrix.shear(0, tan(points[0]*deg2rad)); |
1155 matrix.shear(0, qTan(points[0]*deg2rad)); |
1156 } |
1156 } |
1157 } |
1157 } |
1158 error: |
1158 error: |
1159 return matrix; |
1159 return matrix; |
1160 } |
1160 } |
1479 if (sweep_flag == large_arc_flag) sfactor = -sfactor; |
1479 if (sweep_flag == large_arc_flag) sfactor = -sfactor; |
1480 xc = 0.5 * (x0 + x1) - sfactor * (y1 - y0); |
1480 xc = 0.5 * (x0 + x1) - sfactor * (y1 - y0); |
1481 yc = 0.5 * (y0 + y1) + sfactor * (x1 - x0); |
1481 yc = 0.5 * (y0 + y1) + sfactor * (x1 - x0); |
1482 /* (xc, yc) is center of the circle. */ |
1482 /* (xc, yc) is center of the circle. */ |
1483 |
1483 |
1484 th0 = atan2(y0 - yc, x0 - xc); |
1484 th0 = qAtan2(y0 - yc, x0 - xc); |
1485 th1 = atan2(y1 - yc, x1 - xc); |
1485 th1 = qAtan2(y1 - yc, x1 - xc); |
1486 |
1486 |
1487 th_arc = th1 - th0; |
1487 th_arc = th1 - th0; |
1488 if (th_arc < 0 && sweep_flag) |
1488 if (th_arc < 0 && sweep_flag) |
1489 th_arc += 2 * Q_PI; |
1489 th_arc += 2 * Q_PI; |
1490 else if (th_arc > 0 && !sweep_flag) |
1490 else if (th_arc > 0 && !sweep_flag) |
1576 if (count < 2) { |
1576 if (count < 2) { |
1577 num++; |
1577 num++; |
1578 count--; |
1578 count--; |
1579 break; |
1579 break; |
1580 } |
1580 } |
1581 x = x0 = num[0] + offsetX; |
1581 x = num[0] + offsetX; |
1582 y = y0 = num[1] + offsetY; |
1582 y = num[1] + offsetY; |
1583 num += 2; |
1583 num += 2; |
1584 count -= 2; |
1584 count -= 2; |
1585 path.lineTo(x, y); |
1585 path.lineTo(x, y); |
1586 |
1586 |
1587 } |
1587 } |
1590 if (count < 2) { |
1590 if (count < 2) { |
1591 num++; |
1591 num++; |
1592 count--; |
1592 count--; |
1593 break; |
1593 break; |
1594 } |
1594 } |
1595 x = x0 = num[0]; |
1595 x = num[0]; |
1596 y = y0 = num[1]; |
1596 y = num[1]; |
1597 num += 2; |
1597 num += 2; |
1598 count -= 2; |
1598 count -= 2; |
1599 path.lineTo(x, y); |
1599 path.lineTo(x, y); |
1600 } |
1600 } |
1601 break; |
1601 break; |
2862 |
2862 |
2863 //same QPolygon parsing is in createPolylineNode |
2863 //same QPolygon parsing is in createPolylineNode |
2864 const QChar *s = pointsStr.constData(); |
2864 const QChar *s = pointsStr.constData(); |
2865 QVector<qreal> points = parseNumbersList(s); |
2865 QVector<qreal> points = parseNumbersList(s); |
2866 QPolygonF poly(points.count()/2); |
2866 QPolygonF poly(points.count()/2); |
2867 int i = 0; |
2867 for (int i = 0; i < poly.size(); ++i) |
2868 QVector<qreal>::const_iterator itr = points.constBegin(); |
2868 poly[i] = QPointF(points.at(2 * i), points.at(2 * i + 1)); |
2869 while (itr != points.constEnd()) { |
|
2870 qreal one = *itr; ++itr; |
|
2871 qreal two = *itr; ++itr; |
|
2872 poly[i] = QPointF(one, two); |
|
2873 ++i; |
|
2874 } |
|
2875 QSvgNode *polygon = new QSvgPolygon(parent, poly); |
2869 QSvgNode *polygon = new QSvgPolygon(parent, poly); |
2876 return polygon; |
2870 return polygon; |
2877 } |
2871 } |
2878 |
2872 |
2879 static QSvgNode *createPolylineNode(QSvgNode *parent, |
2873 static QSvgNode *createPolylineNode(QSvgNode *parent, |
2884 |
2878 |
2885 //same QPolygon parsing is in createPolygonNode |
2879 //same QPolygon parsing is in createPolygonNode |
2886 const QChar *s = pointsStr.constData(); |
2880 const QChar *s = pointsStr.constData(); |
2887 QVector<qreal> points = parseNumbersList(s); |
2881 QVector<qreal> points = parseNumbersList(s); |
2888 QPolygonF poly(points.count()/2); |
2882 QPolygonF poly(points.count()/2); |
2889 int i = 0; |
2883 for (int i = 0; i < poly.size(); ++i) |
2890 QVector<qreal>::const_iterator itr = points.constBegin(); |
2884 poly[i] = QPointF(points.at(2 * i), points.at(2 * i + 1)); |
2891 while (itr != points.constEnd()) { |
|
2892 qreal one = *itr; ++itr; |
|
2893 qreal two = *itr; ++itr; |
|
2894 poly[i] = QPointF(one, two); |
|
2895 ++i; |
|
2896 } |
|
2897 |
2885 |
2898 QSvgNode *line = new QSvgPolyline(parent, poly); |
2886 QSvgNode *line = new QSvgPolyline(parent, poly); |
2899 return line; |
2887 return line; |
2900 } |
2888 } |
2901 |
2889 |