OpenCoverage

qquicksvgparser.cpp

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/util/qquicksvgparser.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6__attribute__((visibility("default"))) double qstrtod(const char *s00, char const **se, bool *ok);-
7-
8static inline bool isDigit(ushort ch)-
9{-
10 static quint16 magic = 0x3ff;-
11 return
executed 19176 times by 3 tests: return ((ch >> 4) == 3) && (magic >> (ch & 15));
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
((ch >> 4) == 3) && (magic >> (ch & 15));
executed 19176 times by 3 tests: return ((ch >> 4) == 3) && (magic >> (ch & 15));
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
19176
12}-
13-
14static qreal toDouble(const QChar *&str)-
15{-
16 const int maxLen = 255;-
17 char temp[maxLen+1];-
18 int pos = 0;-
19-
20 if (*
*str == QLatin1Char('-')Description
TRUEevaluated 752 times by 1 test
Evaluated by:
  • tst_examples
FALSEevaluated 1212 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
str == QLatin1Char('-')
*str == QLatin1Char('-')Description
TRUEevaluated 752 times by 1 test
Evaluated by:
  • tst_examples
FALSEevaluated 1212 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
) {
752-1212
21 temp[pos++] = '-';-
22 ++str;-
23 }
executed 752 times by 1 test: end of block
Executed by:
  • tst_examples
else if (*
*str == QLatin1Char('+')Description
TRUEnever evaluated
FALSEevaluated 1212 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
str == QLatin1Char('+')
*str == QLatin1Char('+')Description
TRUEnever evaluated
FALSEevaluated 1212 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
) {
0-1212
24 ++str;-
25 }
never executed: end of block
0
26 while (isDigit(str->unicode())
isDigit(str->unicode())Description
TRUEevaluated 3300 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
FALSEevaluated 1964 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
&& pos < maxLen
pos < maxLenDescription
TRUEevaluated 3300 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
FALSEnever evaluated
) {
0-3300
27 temp[pos++] = str->toLatin1();-
28 ++str;-
29 }
executed 3300 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
3300
30 if (*
*str == QLatin1Char('.')Description
TRUEevaluated 1944 times by 1 test
Evaluated by:
  • tst_examples
FALSEevaluated 20 times by 2 tests
Evaluated by:
  • tst_qquickanimations
  • tst_qquickpath
str == QLatin1Char('.')
*str == QLatin1Char('.')Description
TRUEevaluated 1944 times by 1 test
Evaluated by:
  • tst_examples
FALSEevaluated 20 times by 2 tests
Evaluated by:
  • tst_qquickanimations
  • tst_qquickpath
&& pos < maxLen
pos < maxLenDescription
TRUEevaluated 1944 times by 1 test
Evaluated by:
  • tst_examples
FALSEnever evaluated
) {
0-1944
31 temp[pos++] = '.';-
32 ++str;-
33 }
executed 1944 times by 1 test: end of block
Executed by:
  • tst_examples
1944
34 while (isDigit(str->unicode())
isDigit(str->unicode())Description
TRUEevaluated 9944 times by 1 test
Evaluated by:
  • tst_examples
FALSEevaluated 1964 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
&& pos < maxLen
pos < maxLenDescription
TRUEevaluated 9944 times by 1 test
Evaluated by:
  • tst_examples
FALSEnever evaluated
) {
0-9944
35 temp[pos++] = str->toLatin1();-
36 ++str;-
37 }
executed 9944 times by 1 test: end of block
Executed by:
  • tst_examples
9944
38 bool exponent = false;-
39 if ((*
*str == QLatin1Char('e')Description
TRUEnever evaluated
FALSEevaluated 1964 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
str == QLatin1Char('e')
*str == QLatin1Char('e')Description
TRUEnever evaluated
FALSEevaluated 1964 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
|| *
*str == QLatin1Char('E')Description
TRUEnever evaluated
FALSEevaluated 1964 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
str == QLatin1Char('E')
*str == QLatin1Char('E')Description
TRUEnever evaluated
FALSEevaluated 1964 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
) && pos < maxLen
pos < maxLenDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0-1964
40 exponent = true;-
41 temp[pos++] = 'e';-
42 ++str;-
43 if ((*
*str == QLatin1Char('-')Description
TRUEnever evaluated
FALSEnever evaluated
str == QLatin1Char('-')
*str == QLatin1Char('-')Description
TRUEnever evaluated
FALSEnever evaluated
|| *
*str == QLatin1Char('+')Description
TRUEnever evaluated
FALSEnever evaluated
str == QLatin1Char('+')
*str == QLatin1Char('+')Description
TRUEnever evaluated
FALSEnever evaluated
) && pos < maxLen
pos < maxLenDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
44 temp[pos++] = str->toLatin1();-
45 ++str;-
46 }
never executed: end of block
0
47 while (isDigit(str->unicode())
isDigit(str->unicode())Description
TRUEnever evaluated
FALSEnever evaluated
&& pos < maxLen
pos < maxLenDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
48 temp[pos++] = str->toLatin1();-
49 ++str;-
50 }
never executed: end of block
0
51 }
never executed: end of block
0
52-
53 temp[pos] = '\0';-
54-
55 qreal val;-
56 if (!exponent
!exponentDescription
TRUEevaluated 1964 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
FALSEnever evaluated
&& pos < 10
pos < 10Description
TRUEevaluated 1840 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
FALSEevaluated 124 times by 1 test
Evaluated by:
  • tst_examples
) {
0-1964
57 int ival = 0;-
58 const char *t = temp;-
59 bool neg = false;-
60 if(*
*t == '-'Description
TRUEevaluated 648 times by 1 test
Evaluated by:
  • tst_examples
FALSEevaluated 1192 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
t == '-'
*t == '-'Description
TRUEevaluated 648 times by 1 test
Evaluated by:
  • tst_examples
FALSEevaluated 1192 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
) {
648-1192
61 neg = true;-
62 ++t;-
63 }
executed 648 times by 1 test: end of block
Executed by:
  • tst_examples
648
64 while(*
*tDescription
TRUEevaluated 4876 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
FALSEevaluated 20 times by 2 tests
Evaluated by:
  • tst_qquickanimations
  • tst_qquickpath
t
*tDescription
TRUEevaluated 4876 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
FALSEevaluated 20 times by 2 tests
Evaluated by:
  • tst_qquickanimations
  • tst_qquickpath
&& *
*t != '.'Description
TRUEevaluated 3056 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
FALSEevaluated 1820 times by 1 test
Evaluated by:
  • tst_examples
t != '.'
*t != '.'Description
TRUEevaluated 3056 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
FALSEevaluated 1820 times by 1 test
Evaluated by:
  • tst_examples
) {
20-4876
65 ival *= 10;-
66 ival += (*t) - '0';-
67 ++t;-
68 }
executed 3056 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
3056
69 if(*
*t == '.'Description
TRUEevaluated 1820 times by 1 test
Evaluated by:
  • tst_examples
FALSEevaluated 20 times by 2 tests
Evaluated by:
  • tst_qquickanimations
  • tst_qquickpath
t == '.'
*t == '.'Description
TRUEevaluated 1820 times by 1 test
Evaluated by:
  • tst_examples
FALSEevaluated 20 times by 2 tests
Evaluated by:
  • tst_qquickanimations
  • tst_qquickpath
) {
20-1820
70 ++t;-
71 int div = 1;-
72 while(*
*tDescription
TRUEevaluated 9160 times by 1 test
Evaluated by:
  • tst_examples
FALSEevaluated 1820 times by 1 test
Evaluated by:
  • tst_examples
t
*tDescription
TRUEevaluated 9160 times by 1 test
Evaluated by:
  • tst_examples
FALSEevaluated 1820 times by 1 test
Evaluated by:
  • tst_examples
) {
1820-9160
73 ival *= 10;-
74 ival += (*t) - '0';-
75 div *= 10;-
76 ++t;-
77 }
executed 9160 times by 1 test: end of block
Executed by:
  • tst_examples
9160
78 val = ((qreal)ival)/((qreal)div);-
79 }
executed 1820 times by 1 test: end of block
Executed by:
  • tst_examples
else {
1820
80 val = ival;-
81 }
executed 20 times by 2 tests: end of block
Executed by:
  • tst_qquickanimations
  • tst_qquickpath
20
82 if (neg
negDescription
TRUEevaluated 648 times by 1 test
Evaluated by:
  • tst_examples
FALSEevaluated 1192 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
)
648-1192
83 val = -val;
executed 648 times by 1 test: val = -val;
Executed by:
  • tst_examples
648
84 }
executed 1840 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
else {
1840
85 bool ok = false;-
86 val = qstrtod(temp, nullptr, &ok);-
87 }
executed 124 times by 1 test: end of block
Executed by:
  • tst_examples
124
88 return
executed 1964 times by 3 tests: return val;
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
val;
executed 1964 times by 3 tests: return val;
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
1964
89-
90}-
91static inline void parseNumbersArray(const QChar *&str, QVarLengthArray<qreal, 8> &points)-
92{-
93 while (str->isSpace()
str->isSpace()Description
TRUEevaluated 190 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
FALSEevaluated 40 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
)
40-190
94 ++
executed 190 times by 2 tests: ++str;
Executed by:
  • tst_examples
  • tst_qquickanimations
str;
executed 190 times by 2 tests: ++str;
Executed by:
  • tst_examples
  • tst_qquickanimations
190
95 while (isDigit(str->unicode())
isDigit(str->unicode())Description
TRUEevaluated 1212 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
FALSEevaluated 792 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
||
792-1212
96 *
*str == QLatin1Char('-')Description
TRUEevaluated 752 times by 1 test
Evaluated by:
  • tst_examples
FALSEevaluated 40 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
str == QLatin1Char('-')
*str == QLatin1Char('-')Description
TRUEevaluated 752 times by 1 test
Evaluated by:
  • tst_examples
FALSEevaluated 40 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
|| *
*str == QLatin1Char('+')Description
TRUEnever evaluated
FALSEevaluated 40 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
str == QLatin1Char('+')
*str == QLatin1Char('+')Description
TRUEnever evaluated
FALSEevaluated 40 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
||
0-752
97 *
*str == QLatin1Char('.')Description
TRUEnever evaluated
FALSEevaluated 40 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
str == QLatin1Char('.')
*str == QLatin1Char('.')Description
TRUEnever evaluated
FALSEevaluated 40 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
) {
0-40
98-
99 points.append(toDouble(str));-
100-
101 while (str->isSpace()
str->isSpace()Description
TRUEevaluated 7140 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
FALSEevaluated 1964 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
)
1964-7140
102 ++
executed 7140 times by 3 tests: ++str;
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
str;
executed 7140 times by 3 tests: ++str;
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
7140
103 if (*
*str == QLatin1Char(',')Description
TRUEevaluated 980 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpath
FALSEevaluated 984 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
str == QLatin1Char(',')
*str == QLatin1Char(',')Description
TRUEevaluated 980 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpath
FALSEevaluated 984 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
)
980-984
104 ++
executed 980 times by 2 tests: ++str;
Executed by:
  • tst_examples
  • tst_qquickpath
str;
executed 980 times by 2 tests: ++str;
Executed by:
  • tst_examples
  • tst_qquickpath
980
105-
106-
107 while (str->isSpace()
str->isSpace()Description
TRUEnever evaluated
FALSEevaluated 1964 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
)
0-1964
108 ++
never executed: ++str;
str;
never executed: ++str;
0
109 }
executed 1964 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
1964
110}
executed 40 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
40
111-
112static void pathArcSegment(QPainterPath &path,-
113 qreal xc, qreal yc,-
114 qreal th0, qreal th1,-
115 qreal rx, qreal ry, qreal xAxisRotation)-
116{-
117 qreal sinTh, cosTh;-
118 qreal a00, a01, a10, a11;-
119 qreal x1, y1, x2, y2, x3, y3;-
120 qreal t;-
121 qreal thHalf;-
122-
123 sinTh = qSin(qDegreesToRadians(xAxisRotation));-
124 cosTh = qCos(qDegreesToRadians(xAxisRotation));-
125-
126 a00 = cosTh * rx;-
127 a01 = -sinTh * ry;-
128 a10 = sinTh * rx;-
129 a11 = cosTh * ry;-
130-
131 thHalf = 0.5 * (th1 - th0);-
132 t = (8.0 / 3.0) * qSin(thHalf * 0.5) * qSin(thHalf * 0.5) / qSin(thHalf);-
133 x1 = xc + qCos(th0) - t * qSin(th0);-
134 y1 = yc + qSin(th0) + t * qCos(th0);-
135 x3 = xc + qCos(th1);-
136 y3 = yc + qSin(th1);-
137 x2 = x3 + t * qSin(th1);-
138 y2 = y3 - t * qCos(th1);-
139-
140 path.cubicTo(a00 * x1 + a01 * y1, a10 * x1 + a11 * y1,-
141 a00 * x2 + a01 * y2, a10 * x2 + a11 * y2,-
142 a00 * x3 + a01 * y3, a10 * x3 + a11 * y3);-
143}
executed 340 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpath
  • tst_qquickshape
340
144-
145void QQuickSvgParser::pathArc(QPainterPath &path,-
146 qreal rx,-
147 qreal ry,-
148 qreal x_axis_rotation,-
149 int large_arc_flag,-
150 int sweep_flag,-
151 qreal x,-
152 qreal y,-
153 qreal curx, qreal cury)-
154{-
155 qreal sin_th, cos_th;-
156 qreal a00, a01, a10, a11;-
157 qreal x0, y0, x1, y1, xc, yc;-
158 qreal d, sfactor, sfactor_sq;-
159 qreal th0, th1, th_arc;-
160 int i, n_segs;-
161 qreal dx, dy, dx1, dy1, Pr1, Pr2, Px, Py, check;-
162-
163 rx = qAbs(rx);-
164 ry = qAbs(ry);-
165-
166 sin_th = qSin(qDegreesToRadians(x_axis_rotation));-
167 cos_th = qCos(qDegreesToRadians(x_axis_rotation));-
168-
169 dx = (curx - x) / 2.0;-
170 dy = (cury - y) / 2.0;-
171 dx1 = cos_th * dx + sin_th * dy;-
172 dy1 = -sin_th * dx + cos_th * dy;-
173 Pr1 = rx * rx;-
174 Pr2 = ry * ry;-
175 Px = dx1 * dx1;-
176 Py = dy1 * dy1;-
177-
178 check = Px / Pr1 + Py / Pr2;-
179 if (check > 1
check > 1Description
TRUEevaluated 136 times by 1 test
Evaluated by:
  • tst_examples
FALSEevaluated 42 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpath
  • tst_qquickshape
) {
42-136
180 rx = rx * qSqrt(check);-
181 ry = ry * qSqrt(check);-
182 }
executed 136 times by 1 test: end of block
Executed by:
  • tst_examples
136
183-
184 a00 = cos_th / rx;-
185 a01 = sin_th / rx;-
186 a10 = -sin_th / ry;-
187 a11 = cos_th / ry;-
188 x0 = a00 * curx + a01 * cury;-
189 y0 = a10 * curx + a11 * cury;-
190 x1 = a00 * x + a01 * y;-
191 y1 = a10 * x + a11 * y;-
192-
193-
194-
195-
196-
197 d = (x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0);-
198 sfactor_sq = 1.0 / d - 0.25;-
199 if (sfactor_sq < 0
sfactor_sq < 0Description
TRUEevaluated 24 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickshape
FALSEevaluated 154 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpath
  • tst_qquickshape
) sfactor_sq = 0;
executed 24 times by 2 tests: sfactor_sq = 0;
Executed by:
  • tst_examples
  • tst_qquickshape
24-154
200 sfactor = qSqrt(sfactor_sq);-
201 if (sweep_flag == large_arc_flag
sweep_flag == large_arc_flagDescription
TRUEevaluated 142 times by 1 test
Evaluated by:
  • tst_examples
FALSEevaluated 36 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpath
  • tst_qquickshape
) sfactor = -sfactor;
executed 142 times by 1 test: sfactor = -sfactor;
Executed by:
  • tst_examples
36-142
202 xc = 0.5 * (x0 + x1) - sfactor * (y1 - y0);-
203 yc = 0.5 * (y0 + y1) + sfactor * (x1 - x0);-
204-
205-
206 th0 = qAtan2(y0 - yc, x0 - xc);-
207 th1 = qAtan2(y1 - yc, x1 - xc);-
208-
209 th_arc = th1 - th0;-
210 if (th_arc < 0
th_arc < 0Description
TRUEevaluated 86 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickshape
FALSEevaluated 92 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpath
  • tst_qquickshape
&& sweep_flag
sweep_flagDescription
TRUEevaluated 78 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickshape
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_examples
)
8-92
211 th_arc += 2 *
executed 78 times by 2 tests: th_arc += 2 * 3.14159265358979323846 ;
Executed by:
  • tst_examples
  • tst_qquickshape
78
212 3.14159265358979323846
executed 78 times by 2 tests: th_arc += 2 * 3.14159265358979323846 ;
Executed by:
  • tst_examples
  • tst_qquickshape
78
213 ;
executed 78 times by 2 tests: th_arc += 2 * 3.14159265358979323846 ;
Executed by:
  • tst_examples
  • tst_qquickshape
78
214 else if (th_arc > 0
th_arc > 0Description
TRUEevaluated 92 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpath
  • tst_qquickshape
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_examples
&& !sweep_flag
!sweep_flagDescription
TRUEnever evaluated
FALSEevaluated 92 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpath
  • tst_qquickshape
)
0-92
215 th_arc -= 2 *
never executed: th_arc -= 2 * 3.14159265358979323846 ;
0
216 3.14159265358979323846
never executed: th_arc -= 2 * 3.14159265358979323846 ;
0
217 ;
never executed: th_arc -= 2 * 3.14159265358979323846 ;
0
218-
219 n_segs = qCeil(qAbs(th_arc / (-
220 3.14159265358979323846 -
221 * 0.5 + 0.001)));-
222-
223 for (i = 0; i < n_segs
i < n_segsDescription
TRUEevaluated 340 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpath
  • tst_qquickshape
FALSEevaluated 178 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpath
  • tst_qquickshape
; i++) {
178-340
224 pathArcSegment(path, xc, yc,-
225 th0 + i * th_arc / n_segs,-
226 th0 + (i + 1) * th_arc / n_segs,-
227 rx, ry, x_axis_rotation);-
228 }
executed 340 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpath
  • tst_qquickshape
340
229}
executed 178 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpath
  • tst_qquickshape
178
230-
231-
232bool QQuickSvgParser::parsePathDataFast(const QString &dataStr, QPainterPath &path)-
233{-
234 qreal x0 = 0, y0 = 0;-
235 qreal x = 0, y = 0;-
236 char lastMode = 0;-
237 QPointF ctrlPt;-
238 const QChar *str = dataStr.constData();-
239 const QChar *end = str + dataStr.size();-
240-
241 while (str != end
str != endDescription
TRUEevaluated 40 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
FALSEevaluated 8 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
) {
8-40
242 while (str->isSpace()
str->isSpace()Description
TRUEnever evaluated
FALSEevaluated 40 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
)
0-40
243 ++
never executed: ++str;
str;
never executed: ++str;
0
244 QChar pathElem = *str;-
245 ++str;-
246 QVarLengthArray<qreal, 8> arg;-
247 parseNumbersArray(str, arg);-
248 if (pathElem == QLatin1Char('z')
pathElem == QLatin1Char('z')Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_examples
FALSEevaluated 36 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
|| pathElem == QLatin1Char('Z')
pathElem == QLatin1Char('Z')Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_examples
FALSEevaluated 32 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
)
4-36
249 arg.append(0);
executed 8 times by 1 test: arg.append(0);
Executed by:
  • tst_examples
8
250 const qreal *num = arg.constData();-
251 int count = arg.count();-
252 while (count > 0
count > 0Description
TRUEevaluated 348 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
FALSEevaluated 40 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
) {
40-348
253 qreal offsetX = x;-
254 qreal offsetY = y;-
255 switch (pathElem.unicode()) {-
256 case
executed 8 times by 1 test: case 'm':
Executed by:
  • tst_examples
'm':
executed 8 times by 1 test: case 'm':
Executed by:
  • tst_examples
{
8
257 if (count < 2
count < 2Description
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_examples
) {
0-8
258 num++;-
259 count--;-
260 break;
never executed: break;
0
261 }-
262 x = x0 = num[0] + offsetX;-
263 y = y0 = num[1] + offsetY;-
264 num += 2;-
265 count -= 2;-
266 path.moveTo(x0, y0);-
267-
268-
269-
270-
271 pathElem = QLatin1Char('l');-
272 }-
273 break;
executed 8 times by 1 test: break;
Executed by:
  • tst_examples
8
274 case
executed 4 times by 2 tests: case 'M':
Executed by:
  • tst_qquickanimations
  • tst_qquickpath
'M':
executed 4 times by 2 tests: case 'M':
Executed by:
  • tst_qquickanimations
  • tst_qquickpath
{
4
275 if (count < 2
count < 2Description
TRUEnever evaluated
FALSEevaluated 4 times by 2 tests
Evaluated by:
  • tst_qquickanimations
  • tst_qquickpath
) {
0-4
276 num++;-
277 count--;-
278 break;
never executed: break;
0
279 }-
280 x = x0 = num[0];-
281 y = y0 = num[1];-
282 num += 2;-
283 count -= 2;-
284 path.moveTo(x0, y0);-
285-
286-
287-
288-
289 pathElem = QLatin1Char('L');-
290 }-
291 break;
executed 4 times by 2 tests: break;
Executed by:
  • tst_qquickanimations
  • tst_qquickpath
4
292 case
executed 4 times by 1 test: case 'z':
Executed by:
  • tst_examples
'z':
executed 4 times by 1 test: case 'z':
Executed by:
  • tst_examples
4
293 case
executed 4 times by 1 test: case 'Z':
Executed by:
  • tst_examples
'Z':
executed 4 times by 1 test: case 'Z':
Executed by:
  • tst_examples
{
4
294 x = x0;-
295 y = y0;-
296 count--;-
297 num++;-
298 path.closeSubpath();-
299 }-
300 break;
executed 8 times by 1 test: break;
Executed by:
  • tst_examples
8
301 case
executed 4 times by 1 test: case 'l':
Executed by:
  • tst_examples
'l':
executed 4 times by 1 test: case 'l':
Executed by:
  • tst_examples
{
4
302 if (count < 2
count < 2Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_examples
) {
0-4
303 num++;-
304 count--;-
305 break;
never executed: break;
0
306 }-
307 x = num[0] + offsetX;-
308 y = num[1] + offsetY;-
309 num += 2;-
310 count -= 2;-
311 path.lineTo(x, y);-
312-
313 }-
314 break;
executed 4 times by 1 test: break;
Executed by:
  • tst_examples
4
315 case
never executed: case 'L':
'L':
never executed: case 'L':
{
0
316 if (count < 2
count < 2Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
317 num++;-
318 count--;-
319 break;
never executed: break;
0
320 }-
321 x = num[0];-
322 y = num[1];-
323 num += 2;-
324 count -= 2;-
325 path.lineTo(x, y);-
326 }-
327 break;
never executed: break;
0
328 case
never executed: case 'h':
'h':
never executed: case 'h':
{
0
329 x = num[0] + offsetX;-
330 num++;-
331 count--;-
332 path.lineTo(x, y);-
333 }-
334 break;
never executed: break;
0
335 case
never executed: case 'H':
'H':
never executed: case 'H':
{
0
336 x = num[0];-
337 num++;-
338 count--;-
339 path.lineTo(x, y);-
340 }-
341 break;
never executed: break;
0
342 case
never executed: case 'v':
'v':
never executed: case 'v':
{
0
343 y = num[0] + offsetY;-
344 num++;-
345 count--;-
346 path.lineTo(x, y);-
347 }-
348 break;
never executed: break;
0
349 case
never executed: case 'V':
'V':
never executed: case 'V':
{
0
350 y = num[0];-
351 num++;-
352 count--;-
353 path.lineTo(x, y);-
354 }-
355 break;
never executed: break;
0
356 case
executed 288 times by 1 test: case 'c':
Executed by:
  • tst_examples
'c':
executed 288 times by 1 test: case 'c':
Executed by:
  • tst_examples
{
288
357 if (count < 6
count < 6Description
TRUEnever evaluated
FALSEevaluated 288 times by 1 test
Evaluated by:
  • tst_examples
) {
0-288
358 num += count;-
359 count = 0;-
360 break;
never executed: break;
0
361 }-
362 QPointF c1(num[0] + offsetX, num[1] + offsetY);-
363 QPointF c2(num[2] + offsetX, num[3] + offsetY);-
364 QPointF e(num[4] + offsetX, num[5] + offsetY);-
365 num += 6;-
366 count -= 6;-
367 path.cubicTo(c1, c2, e);-
368 ctrlPt = c2;-
369 x = e.x();-
370 y = e.y();-
371 break;
executed 288 times by 1 test: break;
Executed by:
  • tst_examples
288
372 }-
373 case
executed 32 times by 1 test: case 'C':
Executed by:
  • tst_examples
'C':
executed 32 times by 1 test: case 'C':
Executed by:
  • tst_examples
{
32
374 if (count < 6
count < 6Description
TRUEnever evaluated
FALSEevaluated 32 times by 1 test
Evaluated by:
  • tst_examples
) {
0-32
375 num += count;-
376 count = 0;-
377 break;
never executed: break;
0
378 }-
379 QPointF c1(num[0], num[1]);-
380 QPointF c2(num[2], num[3]);-
381 QPointF e(num[4], num[5]);-
382 num += 6;-
383 count -= 6;-
384 path.cubicTo(c1, c2, e);-
385 ctrlPt = c2;-
386 x = e.x();-
387 y = e.y();-
388 break;
executed 32 times by 1 test: break;
Executed by:
  • tst_examples
32
389 }-
390 case
never executed: case 's':
's':
never executed: case 's':
{
0
391 if (count < 4
count < 4Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
392 num += count;-
393 count = 0;-
394 break;
never executed: break;
0
395 }-
396 QPointF c1;-
397 if (lastMode == 'c'
lastMode == 'c'Description
TRUEnever evaluated
FALSEnever evaluated
|| lastMode == 'C'
lastMode == 'C'Description
TRUEnever evaluated
FALSEnever evaluated
||
0
398 lastMode == 's'
lastMode == 's'Description
TRUEnever evaluated
FALSEnever evaluated
|| lastMode == 'S'
lastMode == 'S'Description
TRUEnever evaluated
FALSEnever evaluated
)
0
399 c1 = QPointF(2*x-ctrlPt.x(), 2*y-ctrlPt.y());
never executed: c1 = QPointF(2*x-ctrlPt.x(), 2*y-ctrlPt.y());
0
400 else-
401 c1 = QPointF(x, y);
never executed: c1 = QPointF(x, y);
0
402 QPointF c2(num[0] + offsetX, num[1] + offsetY);-
403 QPointF e(num[2] + offsetX, num[3] + offsetY);-
404 num += 4;-
405 count -= 4;-
406 path.cubicTo(c1, c2, e);-
407 ctrlPt = c2;-
408 x = e.x();-
409 y = e.y();-
410 break;
never executed: break;
0
411 }-
412 case
never executed: case 'S':
'S':
never executed: case 'S':
{
0
413 if (count < 4
count < 4Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
414 num += count;-
415 count = 0;-
416 break;
never executed: break;
0
417 }-
418 QPointF c1;-
419 if (lastMode == 'c'
lastMode == 'c'Description
TRUEnever evaluated
FALSEnever evaluated
|| lastMode == 'C'
lastMode == 'C'Description
TRUEnever evaluated
FALSEnever evaluated
||
0
420 lastMode == 's'
lastMode == 's'Description
TRUEnever evaluated
FALSEnever evaluated
|| lastMode == 'S'
lastMode == 'S'Description
TRUEnever evaluated
FALSEnever evaluated
)
0
421 c1 = QPointF(2*x-ctrlPt.x(), 2*y-ctrlPt.y());
never executed: c1 = QPointF(2*x-ctrlPt.x(), 2*y-ctrlPt.y());
0
422 else-
423 c1 = QPointF(x, y);
never executed: c1 = QPointF(x, y);
0
424 QPointF c2(num[0], num[1]);-
425 QPointF e(num[2], num[3]);-
426 num += 4;-
427 count -= 4;-
428 path.cubicTo(c1, c2, e);-
429 ctrlPt = c2;-
430 x = e.x();-
431 y = e.y();-
432 break;
never executed: break;
0
433 }-
434 case
never executed: case 'q':
'q':
never executed: case 'q':
{
0
435 if (count < 4
count < 4Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
436 num += count;-
437 count = 0;-
438 break;
never executed: break;
0
439 }-
440 QPointF c(num[0] + offsetX, num[1] + offsetY);-
441 QPointF e(num[2] + offsetX, num[3] + offsetY);-
442 num += 4;-
443 count -= 4;-
444 path.quadTo(c, e);-
445 ctrlPt = c;-
446 x = e.x();-
447 y = e.y();-
448 break;
never executed: break;
0
449 }-
450 case
executed 2 times by 1 test: case 'Q':
Executed by:
  • tst_qquickpath
'Q':
executed 2 times by 1 test: case 'Q':
Executed by:
  • tst_qquickpath
{
2
451 if (count < 4
count < 4Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickpath
) {
0-2
452 num += count;-
453 count = 0;-
454 break;
never executed: break;
0
455 }-
456 QPointF c(num[0], num[1]);-
457 QPointF e(num[2], num[3]);-
458 num += 4;-
459 count -= 4;-
460 path.quadTo(c, e);-
461 ctrlPt = c;-
462 x = e.x();-
463 y = e.y();-
464 break;
executed 2 times by 1 test: break;
Executed by:
  • tst_qquickpath
2
465 }-
466 case
never executed: case 't':
't':
never executed: case 't':
{
0
467 if (count < 2
count < 2Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
468 num += count;-
469 count = 0;-
470 break;
never executed: break;
0
471 }-
472 QPointF e(num[0] + offsetX, num[1] + offsetY);-
473 num += 2;-
474 count -= 2;-
475 QPointF c;-
476 if (lastMode == 'q'
lastMode == 'q'Description
TRUEnever evaluated
FALSEnever evaluated
|| lastMode == 'Q'
lastMode == 'Q'Description
TRUEnever evaluated
FALSEnever evaluated
||
0
477 lastMode == 't'
lastMode == 't'Description
TRUEnever evaluated
FALSEnever evaluated
|| lastMode == 'T'
lastMode == 'T'Description
TRUEnever evaluated
FALSEnever evaluated
)
0
478 c = QPointF(2*x-ctrlPt.x(), 2*y-ctrlPt.y());
never executed: c = QPointF(2*x-ctrlPt.x(), 2*y-ctrlPt.y());
0
479 else-
480 c = QPointF(x, y);
never executed: c = QPointF(x, y);
0
481 path.quadTo(c, e);-
482 ctrlPt = c;-
483 x = e.x();-
484 y = e.y();-
485 break;
never executed: break;
0
486 }-
487 case
executed 2 times by 1 test: case 'T':
Executed by:
  • tst_qquickpath
'T':
executed 2 times by 1 test: case 'T':
Executed by:
  • tst_qquickpath
{
2
488 if (count < 2
count < 2Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickpath
) {
0-2
489 num += count;-
490 count = 0;-
491 break;
never executed: break;
0
492 }-
493 QPointF e(num[0], num[1]);-
494 num += 2;-
495 count -= 2;-
496 QPointF c;-
497 if (lastMode == 'q'
lastMode == 'q'Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickpath
|| lastMode == 'Q'
lastMode == 'Q'Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickpath
FALSEnever evaluated
||
0-2
498 lastMode == 't'
lastMode == 't'Description
TRUEnever evaluated
FALSEnever evaluated
|| lastMode == 'T'
lastMode == 'T'Description
TRUEnever evaluated
FALSEnever evaluated
)
0
499 c = QPointF(2*x-ctrlPt.x(), 2*y-ctrlPt.y());
executed 2 times by 1 test: c = QPointF(2*x-ctrlPt.x(), 2*y-ctrlPt.y());
Executed by:
  • tst_qquickpath
2
500 else-
501 c = QPointF(x, y);
never executed: c = QPointF(x, y);
0
502 path.quadTo(c, e);-
503 ctrlPt = c;-
504 x = e.x();-
505 y = e.y();-
506 break;
executed 2 times by 1 test: break;
Executed by:
  • tst_qquickpath
2
507 }-
508 case
never executed: case 'a':
'a':
never executed: case 'a':
{
0
509 if (count < 7
count < 7Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
510 num += count;-
511 count = 0;-
512 break;
never executed: break;
0
513 }-
514 qreal rx = (*num++);-
515 qreal ry = (*num++);-
516 qreal xAxisRotation = (*num++);-
517 qreal largeArcFlag = (*num++);-
518 qreal sweepFlag = (*num++);-
519 qreal ex = (*num++) + offsetX;-
520 qreal ey = (*num++) + offsetY;-
521 count -= 7;-
522 qreal curx = x;-
523 qreal cury = y;-
524 pathArc(path, rx, ry, xAxisRotation, int(largeArcFlag),-
525 int(sweepFlag), ex, ey, curx, cury);-
526-
527 x = ex;-
528 y = ey;-
529 }-
530 break;
never executed: break;
0
531 case
never executed: case 'A':
'A':
never executed: case 'A':
{
0
532 if (count < 7
count < 7Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
533 num += count;-
534 count = 0;-
535 break;
never executed: break;
0
536 }-
537 qreal rx = (*num++);-
538 qreal ry = (*num++);-
539 qreal xAxisRotation = (*num++);-
540 qreal largeArcFlag = (*num++);-
541 qreal sweepFlag = (*num++);-
542 qreal ex = (*num++);-
543 qreal ey = (*num++);-
544 count -= 7;-
545 qreal curx = x;-
546 qreal cury = y;-
547 pathArc(path, rx, ry, xAxisRotation, int(largeArcFlag),-
548 int(sweepFlag), ex, ey, curx, cury);-
549-
550 x = ex;-
551 y = ey;-
552 }-
553 break;
never executed: break;
0
554 default
never executed: default:
:
never executed: default:
0
555 return
never executed: return false;
false;
never executed: return false;
0
556 }-
557 lastMode = pathElem.toLatin1();-
558 }
executed 348 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
348
559 }
executed 40 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
40
560 return
executed 8 times by 3 tests: return true;
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
true;
executed 8 times by 3 tests: return true;
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
8
561}-
562-
563-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.0