Line | Source Code | Coverage |
---|
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | QTransform::QTransform() | - |
6 | : affine(true) | - |
7 | , m_13(0), m_23(0), m_33(1) | - |
8 | , m_type(TxNone) | - |
9 | , m_dirty(TxNone) | - |
10 | { | - |
11 | } executed: } Execution Count:599347 | 599347 |
12 | QTransform::QTransform(qreal h11, qreal h12, qreal h13, | - |
13 | qreal h21, qreal h22, qreal h23, | - |
14 | qreal h31, qreal h32, qreal h33) | - |
15 | : affine(h11, h12, h21, h22, h31, h32, true) | - |
16 | , m_13(h13), m_23(h23), m_33(h33) | - |
17 | , m_type(TxNone) | - |
18 | , m_dirty(TxProject) | - |
19 | { | - |
20 | } executed: } Execution Count:10858 | 10858 |
21 | QTransform::QTransform(qreal h11, qreal h12, qreal h21, | - |
22 | qreal h22, qreal dx, qreal dy) | - |
23 | : affine(h11, h12, h21, h22, dx, dy, true) | - |
24 | , m_13(0), m_23(0), m_33(1) | - |
25 | , m_type(TxNone) | - |
26 | , m_dirty(TxShear) | - |
27 | { | - |
28 | } executed: } Execution Count:46 | 46 |
29 | QTransform::QTransform(const QMatrix &mtx) | - |
30 | : affine(mtx._m11, mtx._m12, mtx._m21, mtx._m22, mtx._dx, mtx._dy, true), | - |
31 | m_13(0), m_23(0), m_33(1) | - |
32 | , m_type(TxNone) | - |
33 | , m_dirty(TxShear) | - |
34 | { | - |
35 | } executed: } Execution Count:379 | 379 |
36 | | - |
37 | | - |
38 | | - |
39 | | - |
40 | QTransform QTransform::adjoint() const | - |
41 | { | - |
42 | qreal h11, h12, h13, | - |
43 | h21, h22, h23, | - |
44 | h31, h32, h33; | - |
45 | h11 = affine._m22*m_33 - m_23*affine._dy; | - |
46 | h21 = m_23*affine._dx - affine._m21*m_33; | - |
47 | h31 = affine._m21*affine._dy - affine._m22*affine._dx; | - |
48 | h12 = m_13*affine._dy - affine._m12*m_33; | - |
49 | h22 = affine._m11*m_33 - m_13*affine._dx; | - |
50 | h32 = affine._m12*affine._dx - affine._m11*affine._dy; | - |
51 | h13 = affine._m12*m_23 - m_13*affine._m22; | - |
52 | h23 = m_13*affine._m21 - affine._m11*m_23; | - |
53 | h33 = affine._m11*affine._m22 - affine._m12*affine._m21; | - |
54 | | - |
55 | return QTransform(h11, h12, h13, | 21 |
56 | h21, h22, h23, | 21 |
57 | h31, h32, h33, true); executed: return QTransform(h11, h12, h13, h21, h22, h23, h31, h32, h33, true); Execution Count:21 | 21 |
58 | } | - |
59 | | - |
60 | | - |
61 | | - |
62 | | - |
63 | QTransform QTransform::transposed() const | - |
64 | { | - |
65 | QTransform t(affine._m11, affine._m21, affine._dx, | - |
66 | affine._m12, affine._m22, affine._dy, | - |
67 | m_13, m_23, m_33, true); | - |
68 | t.m_type = m_type; | - |
69 | t.m_dirty = m_dirty; | - |
70 | return t; never executed: return t; | 0 |
71 | } | - |
72 | QTransform QTransform::inverted(bool *invertible) const | - |
73 | { | - |
74 | QTransform invert(true); | - |
75 | bool inv = true; | - |
76 | | - |
77 | switch(inline_type()) { | - |
78 | case TxNone: | - |
79 | break; executed: break; Execution Count:214 | 214 |
80 | case TxTranslate: | - |
81 | invert.affine._dx = -affine._dx; | - |
82 | invert.affine._dy = -affine._dy; | - |
83 | break; executed: break; Execution Count:3737 | 3737 |
84 | case TxScale: | - |
85 | inv = !qFuzzyIsNull(affine._m11); | - |
86 | inv &= !qFuzzyIsNull(affine._m22); | - |
87 | if (inv) { partially evaluated: inv yes Evaluation Count:502 | no Evaluation Count:0 |
| 0-502 |
88 | invert.affine._m11 = 1. / affine._m11; | - |
89 | invert.affine._m22 = 1. / affine._m22; | - |
90 | invert.affine._dx = -affine._dx * invert.affine._m11; | - |
91 | invert.affine._dy = -affine._dy * invert.affine._m22; | - |
92 | } executed: } Execution Count:502 | 502 |
93 | break; executed: break; Execution Count:502 | 502 |
94 | case TxRotate: | - |
95 | case TxShear: | - |
96 | invert.affine = affine.inverted(&inv); | - |
97 | break; executed: break; Execution Count:3292 | 3292 |
98 | default: | - |
99 | | - |
100 | qreal det = determinant(); | - |
101 | inv = !qFuzzyIsNull(det); | - |
102 | if (inv) partially evaluated: inv yes Evaluation Count:20 | no Evaluation Count:0 |
| 0-20 |
103 | invert = adjoint() / det; executed: invert = adjoint() / det; Execution Count:20 | 20 |
104 | break; executed: break; Execution Count:20 | 20 |
105 | } | - |
106 | | - |
107 | if (invertible) evaluated: invertible yes Evaluation Count:21 | yes Evaluation Count:7744 |
| 21-7744 |
108 | *invertible = inv; executed: *invertible = inv; Execution Count:21 | 21 |
109 | | - |
110 | if (inv) { partially evaluated: inv yes Evaluation Count:7765 | no Evaluation Count:0 |
| 0-7765 |
111 | | - |
112 | invert.m_type = m_type; | - |
113 | invert.m_dirty = m_dirty; | - |
114 | } executed: } Execution Count:7765 | 7765 |
115 | | - |
116 | return invert; executed: return invert; Execution Count:7765 | 7765 |
117 | } | - |
118 | | - |
119 | | - |
120 | | - |
121 | | - |
122 | | - |
123 | | - |
124 | | - |
125 | QTransform &QTransform::translate(qreal dx, qreal dy) | - |
126 | { | - |
127 | if (dx == 0 && dy == 0) evaluated: dx == 0 yes Evaluation Count:251980 | yes Evaluation Count:61364 |
evaluated: dy == 0 yes Evaluation Count:233705 | yes Evaluation Count:18275 |
| 18275-251980 |
128 | return *this; executed: return *this; Execution Count:233704 | 233704 |
129 | | - |
130 | | - |
131 | | - |
132 | | - |
133 | | - |
134 | | - |
135 | | - |
136 | switch(inline_type()) { | - |
137 | case TxNone: | - |
138 | affine._dx = dx; | - |
139 | affine._dy = dy; | - |
140 | break; executed: break; Execution Count:19115 | 19115 |
141 | case TxTranslate: | - |
142 | affine._dx += dx; | - |
143 | affine._dy += dy; | - |
144 | break; executed: break; Execution Count:60329 | 60329 |
145 | case TxScale: | - |
146 | affine._dx += dx*affine._m11; | - |
147 | affine._dy += dy*affine._m22; | - |
148 | break; executed: break; Execution Count:68 | 68 |
149 | case TxProject: | - |
150 | m_33 += dx*m_13 + dy*m_23; | - |
151 | | - |
152 | case TxShear: code before this statement executed: case TxShear: Execution Count:4 | 4 |
153 | case TxRotate: | - |
154 | affine._dx += dx*affine._m11 + dy*affine._m21; | - |
155 | affine._dy += dy*affine._m22 + dx*affine._m12; | - |
156 | break; executed: break; Execution Count:127 | 127 |
157 | } | - |
158 | if (m_dirty < TxTranslate) evaluated: m_dirty < TxTranslate yes Evaluation Count:79626 | yes Evaluation Count:13 |
| 13-79626 |
159 | m_dirty = TxTranslate; executed: m_dirty = TxTranslate; Execution Count:79626 | 79626 |
160 | return *this; executed: return *this; Execution Count:79639 | 79639 |
161 | } | - |
162 | QTransform QTransform::fromTranslate(qreal dx, qreal dy) | - |
163 | { | - |
164 | | - |
165 | | - |
166 | | - |
167 | | - |
168 | | - |
169 | | - |
170 | QTransform transform(1, 0, 0, 0, 1, 0, dx, dy, 1, true); | - |
171 | if (dx == 0 && dy == 0) evaluated: dx == 0 yes Evaluation Count:529 | yes Evaluation Count:3182 |
evaluated: dy == 0 yes Evaluation Count:480 | yes Evaluation Count:49 |
| 49-3182 |
172 | transform.m_type = TxNone; executed: transform.m_type = TxNone; Execution Count:480 | 480 |
173 | else | - |
174 | transform.m_type = TxTranslate; executed: transform.m_type = TxTranslate; Execution Count:3231 | 3231 |
175 | transform.m_dirty = TxNone; | - |
176 | return transform; executed: return transform; Execution Count:3711 | 3711 |
177 | } | - |
178 | | - |
179 | | - |
180 | | - |
181 | | - |
182 | | - |
183 | | - |
184 | | - |
185 | QTransform & QTransform::scale(qreal sx, qreal sy) | - |
186 | { | - |
187 | if (sx == 1 && sy == 1) evaluated: sx == 1 yes Evaluation Count:37 | yes Evaluation Count:293 |
evaluated: sy == 1 yes Evaluation Count:28 | yes Evaluation Count:9 |
| 9-293 |
188 | return *this; executed: return *this; Execution Count:28 | 28 |
189 | | - |
190 | | - |
191 | | - |
192 | | - |
193 | | - |
194 | | - |
195 | | - |
196 | switch(inline_type()) { | - |
197 | case TxNone: | - |
198 | case TxTranslate: | - |
199 | affine._m11 = sx; | - |
200 | affine._m22 = sy; | - |
201 | break; executed: break; Execution Count:201 | 201 |
202 | case TxProject: | - |
203 | m_13 *= sx; | - |
204 | m_23 *= sy; | - |
205 | | - |
206 | case TxRotate: code before this statement executed: case TxRotate: Execution Count:2 | 2 |
207 | case TxShear: | - |
208 | affine._m12 *= sx; | - |
209 | affine._m21 *= sy; | - |
210 | | - |
211 | case TxScale: code before this statement executed: case TxScale: Execution Count:50 | 50 |
212 | affine._m11 *= sx; | - |
213 | affine._m22 *= sy; | - |
214 | break; executed: break; Execution Count:101 | 101 |
215 | } | - |
216 | if (m_dirty < TxScale) evaluated: m_dirty < TxScale yes Evaluation Count:294 | yes Evaluation Count:8 |
| 8-294 |
217 | m_dirty = TxScale; executed: m_dirty = TxScale; Execution Count:294 | 294 |
218 | return *this; executed: return *this; Execution Count:302 | 302 |
219 | } | - |
220 | QTransform QTransform::fromScale(qreal sx, qreal sy) | - |
221 | { | - |
222 | | - |
223 | | - |
224 | | - |
225 | | - |
226 | | - |
227 | | - |
228 | QTransform transform(sx, 0, 0, 0, sy, 0, 0, 0, 1, true); | - |
229 | if (sx == 1. && sy == 1.) evaluated: sx == 1. yes Evaluation Count:4 | yes Evaluation Count:251 |
evaluated: sy == 1. yes Evaluation Count:2 | yes Evaluation Count:2 |
| 2-251 |
230 | transform.m_type = TxNone; executed: transform.m_type = TxNone; Execution Count:2 | 2 |
231 | else | - |
232 | transform.m_type = TxScale; executed: transform.m_type = TxScale; Execution Count:253 | 253 |
233 | transform.m_dirty = TxNone; | - |
234 | return transform; executed: return transform; Execution Count:255 | 255 |
235 | } | - |
236 | | - |
237 | | - |
238 | | - |
239 | | - |
240 | | - |
241 | | - |
242 | | - |
243 | QTransform & QTransform::shear(qreal sh, qreal sv) | - |
244 | { | - |
245 | if (sh == 0 && sv == 0) evaluated: sh == 0 yes Evaluation Count:1 | yes Evaluation Count:20 |
partially evaluated: sv == 0 no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-20 |
246 | return *this; never executed: return *this; | 0 |
247 | | - |
248 | | - |
249 | | - |
250 | | - |
251 | | - |
252 | | - |
253 | | - |
254 | switch(inline_type()) { | - |
255 | case TxNone: | - |
256 | case TxTranslate: | - |
257 | affine._m12 = sv; | - |
258 | affine._m21 = sh; | - |
259 | break; executed: break; Execution Count:6 | 6 |
260 | case TxScale: | - |
261 | affine._m12 = sv*affine._m22; | - |
262 | affine._m21 = sh*affine._m11; | - |
263 | break; executed: break; Execution Count:3 | 3 |
264 | case TxProject: { | - |
265 | qreal tm13 = sv*m_23; | - |
266 | qreal tm23 = sh*m_13; | - |
267 | m_13 += tm13; | - |
268 | m_23 += tm23; | - |
269 | } | - |
270 | | - |
271 | case TxRotate: | - |
272 | case TxShear: { | - |
273 | qreal tm11 = sv*affine._m21; | - |
274 | qreal tm22 = sh*affine._m12; | - |
275 | qreal tm12 = sv*affine._m22; | - |
276 | qreal tm21 = sh*affine._m11; | - |
277 | affine._m11 += tm11; affine._m12 += tm12; | - |
278 | affine._m21 += tm21; affine._m22 += tm22; | - |
279 | break; executed: break; Execution Count:12 | 12 |
280 | } | - |
281 | } | - |
282 | if (m_dirty < TxShear) partially evaluated: m_dirty < TxShear yes Evaluation Count:21 | no Evaluation Count:0 |
| 0-21 |
283 | m_dirty = TxShear; executed: m_dirty = TxShear; Execution Count:21 | 21 |
284 | return *this; executed: return *this; Execution Count:21 | 21 |
285 | } | - |
286 | | - |
287 | const qreal deg2rad = qreal(0.017453292519943295769); | - |
288 | const qreal inv_dist_to_plane = 1. / 1024.; | - |
289 | QTransform & QTransform::rotate(qreal a, Qt::Axis axis) | - |
290 | { | - |
291 | if (a == 0) evaluated: a == 0 yes Evaluation Count:33 | yes Evaluation Count:2902 |
| 33-2902 |
292 | return *this; executed: return *this; Execution Count:33 | 33 |
293 | | - |
294 | | - |
295 | | - |
296 | | - |
297 | | - |
298 | | - |
299 | | - |
300 | qreal sina = 0; | - |
301 | qreal cosa = 0; | - |
302 | if (a == 90. || a == -270.) evaluated: a == 90. yes Evaluation Count:38 | yes Evaluation Count:2864 |
evaluated: a == -270. yes Evaluation Count:9 | yes Evaluation Count:2855 |
| 9-2864 |
303 | sina = 1.; executed: sina = 1.; Execution Count:47 | 47 |
304 | else if (a == 270. || a == -90.) evaluated: a == 270. yes Evaluation Count:9 | yes Evaluation Count:2846 |
evaluated: a == -90. yes Evaluation Count:10 | yes Evaluation Count:2836 |
| 9-2846 |
305 | sina = -1.; executed: sina = -1.; Execution Count:19 | 19 |
306 | else if (a == 180.) evaluated: a == 180. yes Evaluation Count:24 | yes Evaluation Count:2812 |
| 24-2812 |
307 | cosa = -1.; executed: cosa = -1.; Execution Count:24 | 24 |
308 | else{ | - |
309 | qreal b = deg2rad*a; | - |
310 | sina = qSin(b); | - |
311 | cosa = qCos(b); | - |
312 | } executed: } Execution Count:2812 | 2812 |
313 | | - |
314 | if (axis == Qt::ZAxis) { evaluated: axis == Qt::ZAxis yes Evaluation Count:2161 | yes Evaluation Count:741 |
| 741-2161 |
315 | switch(inline_type()) { | - |
316 | case TxNone: | - |
317 | case TxTranslate: | - |
318 | affine._m11 = cosa; | - |
319 | affine._m12 = sina; | - |
320 | affine._m21 = -sina; | - |
321 | affine._m22 = cosa; | - |
322 | break; executed: break; Execution Count:1570 | 1570 |
323 | case TxScale: { | - |
324 | qreal tm11 = cosa*affine._m11; | - |
325 | qreal tm12 = sina*affine._m22; | - |
326 | qreal tm21 = -sina*affine._m11; | - |
327 | qreal tm22 = cosa*affine._m22; | - |
328 | affine._m11 = tm11; affine._m12 = tm12; | - |
329 | affine._m21 = tm21; affine._m22 = tm22; | - |
330 | break; executed: break; Execution Count:18 | 18 |
331 | } | - |
332 | case TxProject: { | - |
333 | qreal tm13 = cosa*m_13 + sina*m_23; | - |
334 | qreal tm23 = -sina*m_13 + cosa*m_23; | - |
335 | m_13 = tm13; | - |
336 | m_23 = tm23; | - |
337 | | - |
338 | } | - |
339 | case TxRotate: | - |
340 | case TxShear: { | - |
341 | qreal tm11 = cosa*affine._m11 + sina*affine._m21; | - |
342 | qreal tm12 = cosa*affine._m12 + sina*affine._m22; | - |
343 | qreal tm21 = -sina*affine._m11 + cosa*affine._m21; | - |
344 | qreal tm22 = -sina*affine._m12 + cosa*affine._m22; | - |
345 | affine._m11 = tm11; affine._m12 = tm12; | - |
346 | affine._m21 = tm21; affine._m22 = tm22; | - |
347 | break; executed: break; Execution Count:573 | 573 |
348 | } | - |
349 | } | - |
350 | if (m_dirty < TxRotate) evaluated: m_dirty < TxRotate yes Evaluation Count:2160 | yes Evaluation Count:1 |
| 1-2160 |
351 | m_dirty = TxRotate; executed: m_dirty = TxRotate; Execution Count:2160 | 2160 |
352 | } else { executed: } Execution Count:2161 | 2161 |
353 | QTransform result; | - |
354 | if (axis == Qt::YAxis) { evaluated: axis == Qt::YAxis yes Evaluation Count:378 | yes Evaluation Count:363 |
| 363-378 |
355 | result.affine._m11 = cosa; | - |
356 | result.m_13 = -sina * inv_dist_to_plane; | - |
357 | } else { executed: } Execution Count:378 | 378 |
358 | result.affine._m22 = cosa; | - |
359 | result.m_23 = -sina * inv_dist_to_plane; | - |
360 | } executed: } Execution Count:363 | 363 |
361 | result.m_type = TxProject; | - |
362 | *this = result * *this; | - |
363 | } executed: } Execution Count:741 | 741 |
364 | | - |
365 | return *this; executed: return *this; Execution Count:2902 | 2902 |
366 | } | - |
367 | QTransform & QTransform::rotateRadians(qreal a, Qt::Axis axis) | - |
368 | { | - |
369 | | - |
370 | | - |
371 | | - |
372 | | - |
373 | | - |
374 | | - |
375 | qreal sina = qSin(a); | - |
376 | qreal cosa = qCos(a); | - |
377 | | - |
378 | if (axis == Qt::ZAxis) { never evaluated: axis == Qt::ZAxis | 0 |
379 | switch(inline_type()) { | - |
380 | case TxNone: | - |
381 | case TxTranslate: | - |
382 | affine._m11 = cosa; | - |
383 | affine._m12 = sina; | - |
384 | affine._m21 = -sina; | - |
385 | affine._m22 = cosa; | - |
386 | break; | 0 |
387 | case TxScale: { | - |
388 | qreal tm11 = cosa*affine._m11; | - |
389 | qreal tm12 = sina*affine._m22; | - |
390 | qreal tm21 = -sina*affine._m11; | - |
391 | qreal tm22 = cosa*affine._m22; | - |
392 | affine._m11 = tm11; affine._m12 = tm12; | - |
393 | affine._m21 = tm21; affine._m22 = tm22; | - |
394 | break; | 0 |
395 | } | - |
396 | case TxProject: { | - |
397 | qreal tm13 = cosa*m_13 + sina*m_23; | - |
398 | qreal tm23 = -sina*m_13 + cosa*m_23; | - |
399 | m_13 = tm13; | - |
400 | m_23 = tm23; | - |
401 | | - |
402 | } | - |
403 | case TxRotate: | - |
404 | case TxShear: { | - |
405 | qreal tm11 = cosa*affine._m11 + sina*affine._m21; | - |
406 | qreal tm12 = cosa*affine._m12 + sina*affine._m22; | - |
407 | qreal tm21 = -sina*affine._m11 + cosa*affine._m21; | - |
408 | qreal tm22 = -sina*affine._m12 + cosa*affine._m22; | - |
409 | affine._m11 = tm11; affine._m12 = tm12; | - |
410 | affine._m21 = tm21; affine._m22 = tm22; | - |
411 | break; | 0 |
412 | } | - |
413 | } | - |
414 | if (m_dirty < TxRotate) never evaluated: m_dirty < TxRotate | 0 |
415 | m_dirty = TxRotate; never executed: m_dirty = TxRotate; | 0 |
416 | } else { | 0 |
417 | QTransform result; | - |
418 | if (axis == Qt::YAxis) { never evaluated: axis == Qt::YAxis | 0 |
419 | result.affine._m11 = cosa; | - |
420 | result.m_13 = -sina * inv_dist_to_plane; | - |
421 | } else { | 0 |
422 | result.affine._m22 = cosa; | - |
423 | result.m_23 = -sina * inv_dist_to_plane; | - |
424 | } | 0 |
425 | result.m_type = TxProject; | - |
426 | *this = result * *this; | - |
427 | } | 0 |
428 | return *this; never executed: return *this; | 0 |
429 | } | - |
430 | | - |
431 | | - |
432 | | - |
433 | | - |
434 | | - |
435 | | - |
436 | bool QTransform::operator==(const QTransform &o) const | - |
437 | { | - |
438 | return affine._m11 == o.affine._m11 && | 25573 |
439 | affine._m12 == o.affine._m12 && | 25573 |
440 | affine._m21 == o.affine._m21 && | 25573 |
441 | affine._m22 == o.affine._m22 && | 25573 |
442 | affine._dx == o.affine._dx && | 25573 |
443 | affine._dy == o.affine._dy && | 25573 |
444 | m_13 == o.m_13 && | 25573 |
445 | m_23 == o.m_23 && | 25573 |
446 | m_33 == o.m_33; executed: return affine._m11 == o.affine._m11 && affine._m12 == o.affine._m12 && affine._m21 == o.affine._m21 && affine._m22 == o.affine._m22 && affine._dx == o.affine._dx && affine._dy == o.affine._dy && m_13 == o.m_13 && m_23 == o.m_23 && m_33 == o.m_33; Execution Count:25573 | 25573 |
447 | } | - |
448 | | - |
449 | | - |
450 | | - |
451 | | - |
452 | | - |
453 | | - |
454 | bool QTransform::operator!=(const QTransform &o) const | - |
455 | { | - |
456 | return !operator==(o); executed: return !operator==(o); Execution Count:22407 | 22407 |
457 | } | - |
458 | QTransform & QTransform::operator*=(const QTransform &o) | - |
459 | { | - |
460 | const TransformationType otherType = o.inline_type(); | - |
461 | if (otherType == TxNone) evaluated: otherType == TxNone yes Evaluation Count:93290 | yes Evaluation Count:26258 |
| 26258-93290 |
462 | return *this; executed: return *this; Execution Count:93290 | 93290 |
463 | | - |
464 | const TransformationType thisType = inline_type(); | - |
465 | if (thisType == TxNone) evaluated: thisType == TxNone yes Evaluation Count:18138 | yes Evaluation Count:8120 |
| 8120-18138 |
466 | return operator=(o); executed: return operator=(o); Execution Count:18138 | 18138 |
467 | | - |
468 | TransformationType t = qMax(thisType, otherType); | - |
469 | switch(t) { | - |
470 | case TxNone: | - |
471 | break; | 0 |
472 | case TxTranslate: | - |
473 | affine._dx += o.affine._dx; | - |
474 | affine._dy += o.affine._dy; | - |
475 | break; executed: break; Execution Count:3038 | 3038 |
476 | case TxScale: | - |
477 | { | - |
478 | qreal m11 = affine._m11*o.affine._m11; | - |
479 | qreal m22 = affine._m22*o.affine._m22; | - |
480 | | - |
481 | qreal m31 = affine._dx*o.affine._m11 + o.affine._dx; | - |
482 | qreal m32 = affine._dy*o.affine._m22 + o.affine._dy; | - |
483 | | - |
484 | affine._m11 = m11; | - |
485 | affine._m22 = m22; | - |
486 | affine._dx = m31; affine._dy = m32; | - |
487 | break; executed: break; Execution Count:328 | 328 |
488 | } | - |
489 | case TxRotate: | - |
490 | case TxShear: | - |
491 | { | - |
492 | qreal m11 = affine._m11*o.affine._m11 + affine._m12*o.affine._m21; | - |
493 | qreal m12 = affine._m11*o.affine._m12 + affine._m12*o.affine._m22; | - |
494 | | - |
495 | qreal m21 = affine._m21*o.affine._m11 + affine._m22*o.affine._m21; | - |
496 | qreal m22 = affine._m21*o.affine._m12 + affine._m22*o.affine._m22; | - |
497 | | - |
498 | qreal m31 = affine._dx*o.affine._m11 + affine._dy*o.affine._m21 + o.affine._dx; | - |
499 | qreal m32 = affine._dx*o.affine._m12 + affine._dy*o.affine._m22 + o.affine._dy; | - |
500 | | - |
501 | affine._m11 = m11; affine._m12 = m12; | - |
502 | affine._m21 = m21; affine._m22 = m22; | - |
503 | affine._dx = m31; affine._dy = m32; | - |
504 | break; executed: break; Execution Count:4753 | 4753 |
505 | } | - |
506 | case TxProject: | - |
507 | { | - |
508 | qreal m11 = affine._m11*o.affine._m11 + affine._m12*o.affine._m21 + m_13*o.affine._dx; | - |
509 | qreal m12 = affine._m11*o.affine._m12 + affine._m12*o.affine._m22 + m_13*o.affine._dy; | - |
510 | qreal m13 = affine._m11*o.m_13 + affine._m12*o.m_23 + m_13*o.m_33; | - |
511 | | - |
512 | qreal m21 = affine._m21*o.affine._m11 + affine._m22*o.affine._m21 + m_23*o.affine._dx; | - |
513 | qreal m22 = affine._m21*o.affine._m12 + affine._m22*o.affine._m22 + m_23*o.affine._dy; | - |
514 | qreal m23 = affine._m21*o.m_13 + affine._m22*o.m_23 + m_23*o.m_33; | - |
515 | | - |
516 | qreal m31 = affine._dx*o.affine._m11 + affine._dy*o.affine._m21 + m_33*o.affine._dx; | - |
517 | qreal m32 = affine._dx*o.affine._m12 + affine._dy*o.affine._m22 + m_33*o.affine._dy; | - |
518 | qreal m33 = affine._dx*o.m_13 + affine._dy*o.m_23 + m_33*o.m_33; | - |
519 | | - |
520 | affine._m11 = m11; affine._m12 = m12; m_13 = m13; | - |
521 | affine._m21 = m21; affine._m22 = m22; m_23 = m23; | - |
522 | affine._dx = m31; affine._dy = m32; m_33 = m33; | - |
523 | } | - |
524 | } executed: } Execution Count:1 | 1 |
525 | | - |
526 | m_dirty = t; | - |
527 | m_type = t; | - |
528 | | - |
529 | return *this; executed: return *this; Execution Count:8120 | 8120 |
530 | } | - |
531 | QTransform QTransform::operator*(const QTransform &m) const | - |
532 | { | - |
533 | const TransformationType otherType = m.inline_type(); | - |
534 | if (otherType == TxNone) evaluated: otherType == TxNone yes Evaluation Count:1178 | yes Evaluation Count:1534 |
| 1178-1534 |
535 | return *this; executed: return *this; Execution Count:1178 | 1178 |
536 | | - |
537 | const TransformationType thisType = inline_type(); | - |
538 | if (thisType == TxNone) evaluated: thisType == TxNone yes Evaluation Count:37 | yes Evaluation Count:1497 |
| 37-1497 |
539 | return m; executed: return m; Execution Count:37 | 37 |
540 | | - |
541 | QTransform t(true); | - |
542 | TransformationType type = qMax(thisType, otherType); | - |
543 | switch(type) { | - |
544 | case TxNone: | - |
545 | break; | 0 |
546 | case TxTranslate: | - |
547 | t.affine._dx = affine._dx + m.affine._dx; | - |
548 | t.affine._dy += affine._dy + m.affine._dy; | - |
549 | break; executed: break; Execution Count:119 | 119 |
550 | case TxScale: | - |
551 | { | - |
552 | qreal m11 = affine._m11*m.affine._m11; | - |
553 | qreal m22 = affine._m22*m.affine._m22; | - |
554 | | - |
555 | qreal m31 = affine._dx*m.affine._m11 + m.affine._dx; | - |
556 | qreal m32 = affine._dy*m.affine._m22 + m.affine._dy; | - |
557 | | - |
558 | t.affine._m11 = m11; | - |
559 | t.affine._m22 = m22; | - |
560 | t.affine._dx = m31; t.affine._dy = m32; | - |
561 | break; executed: break; Execution Count:385 | 385 |
562 | } | - |
563 | case TxRotate: | - |
564 | case TxShear: | - |
565 | { | - |
566 | qreal m11 = affine._m11*m.affine._m11 + affine._m12*m.affine._m21; | - |
567 | qreal m12 = affine._m11*m.affine._m12 + affine._m12*m.affine._m22; | - |
568 | | - |
569 | qreal m21 = affine._m21*m.affine._m11 + affine._m22*m.affine._m21; | - |
570 | qreal m22 = affine._m21*m.affine._m12 + affine._m22*m.affine._m22; | - |
571 | | - |
572 | qreal m31 = affine._dx*m.affine._m11 + affine._dy*m.affine._m21 + m.affine._dx; | - |
573 | qreal m32 = affine._dx*m.affine._m12 + affine._dy*m.affine._m22 + m.affine._dy; | - |
574 | | - |
575 | t.affine._m11 = m11; t.affine._m12 = m12; | - |
576 | t.affine._m21 = m21; t.affine._m22 = m22; | - |
577 | t.affine._dx = m31; t.affine._dy = m32; | - |
578 | break; executed: break; Execution Count:963 | 963 |
579 | } | - |
580 | case TxProject: | - |
581 | { | - |
582 | qreal m11 = affine._m11*m.affine._m11 + affine._m12*m.affine._m21 + m_13*m.affine._dx; | - |
583 | qreal m12 = affine._m11*m.affine._m12 + affine._m12*m.affine._m22 + m_13*m.affine._dy; | - |
584 | qreal m13 = affine._m11*m.m_13 + affine._m12*m.m_23 + m_13*m.m_33; | - |
585 | | - |
586 | qreal m21 = affine._m21*m.affine._m11 + affine._m22*m.affine._m21 + m_23*m.affine._dx; | - |
587 | qreal m22 = affine._m21*m.affine._m12 + affine._m22*m.affine._m22 + m_23*m.affine._dy; | - |
588 | qreal m23 = affine._m21*m.m_13 + affine._m22*m.m_23 + m_23*m.m_33; | - |
589 | | - |
590 | qreal m31 = affine._dx*m.affine._m11 + affine._dy*m.affine._m21 + m_33*m.affine._dx; | - |
591 | qreal m32 = affine._dx*m.affine._m12 + affine._dy*m.affine._m22 + m_33*m.affine._dy; | - |
592 | qreal m33 = affine._dx*m.m_13 + affine._dy*m.m_23 + m_33*m.m_33; | - |
593 | | - |
594 | t.affine._m11 = m11; t.affine._m12 = m12; t.m_13 = m13; | - |
595 | t.affine._m21 = m21; t.affine._m22 = m22; t.m_23 = m23; | - |
596 | t.affine._dx = m31; t.affine._dy = m32; t.m_33 = m33; | - |
597 | } | - |
598 | } executed: } Execution Count:30 | 30 |
599 | | - |
600 | t.m_dirty = type; | - |
601 | t.m_type = type; | - |
602 | | - |
603 | return t; executed: return t; Execution Count:1497 | 1497 |
604 | } | - |
605 | QTransform & QTransform::operator=(const QTransform &matrix) | - |
606 | { | - |
607 | affine._m11 = matrix.affine._m11; | - |
608 | affine._m12 = matrix.affine._m12; | - |
609 | affine._m21 = matrix.affine._m21; | - |
610 | affine._m22 = matrix.affine._m22; | - |
611 | affine._dx = matrix.affine._dx; | - |
612 | affine._dy = matrix.affine._dy; | - |
613 | m_13 = matrix.m_13; | - |
614 | m_23 = matrix.m_23; | - |
615 | m_33 = matrix.m_33; | - |
616 | m_type = matrix.m_type; | - |
617 | m_dirty = matrix.m_dirty; | - |
618 | | - |
619 | return *this; executed: return *this; Execution Count:118234 | 118234 |
620 | } | - |
621 | void QTransform::reset() | - |
622 | { | - |
623 | affine._m11 = affine._m22 = m_33 = 1.0; | - |
624 | affine._m12 = m_13 = affine._m21 = m_23 = affine._dx = affine._dy = 0; | - |
625 | m_type = TxNone; | - |
626 | m_dirty = TxNone; | - |
627 | } executed: } Execution Count:1 | 1 |
628 | QDataStream & operator<<(QDataStream &s, const QTransform &m) | - |
629 | { | - |
630 | s << double(m.m11()) | - |
631 | << double(m.m12()) | - |
632 | << double(m.m13()) | - |
633 | << double(m.m21()) | - |
634 | << double(m.m22()) | - |
635 | << double(m.m23()) | - |
636 | << double(m.m31()) | - |
637 | << double(m.m32()) | - |
638 | << double(m.m33()); | - |
639 | return s; executed: return s; Execution Count:777 | 777 |
640 | } | - |
641 | QDataStream & operator>>(QDataStream &s, QTransform &t) | - |
642 | { | - |
643 | double m11, m12, m13, | - |
644 | m21, m22, m23, | - |
645 | m31, m32, m33; | - |
646 | | - |
647 | s >> m11; | - |
648 | s >> m12; | - |
649 | s >> m13; | - |
650 | s >> m21; | - |
651 | s >> m22; | - |
652 | s >> m23; | - |
653 | s >> m31; | - |
654 | s >> m32; | - |
655 | s >> m33; | - |
656 | t.setMatrix(m11, m12, m13, | - |
657 | m21, m22, m23, | - |
658 | m31, m32, m33); | - |
659 | return s; executed: return s; Execution Count:745 | 745 |
660 | } | - |
661 | | - |
662 | | - |
663 | | - |
664 | | - |
665 | QDebug operator<<(QDebug dbg, const QTransform &m) | - |
666 | { | - |
667 | static const char *typeStr[] = | - |
668 | { | - |
669 | "TxNone", | - |
670 | "TxTranslate", | - |
671 | "TxScale", | - |
672 | 0, | - |
673 | "TxRotate", | - |
674 | 0, 0, 0, | - |
675 | "TxShear", | - |
676 | 0, 0, 0, 0, 0, 0, 0, | - |
677 | "TxProject" | - |
678 | }; | - |
679 | | - |
680 | dbg.nospace() << "QTransform(type=" << typeStr[m.type()] << ',' | - |
681 | << " 11=" << m.m11() | - |
682 | << " 12=" << m.m12() | - |
683 | << " 13=" << m.m13() | - |
684 | << " 21=" << m.m21() | - |
685 | << " 22=" << m.m22() | - |
686 | << " 23=" << m.m23() | - |
687 | << " 31=" << m.m31() | - |
688 | << " 32=" << m.m32() | - |
689 | << " 33=" << m.m33() | - |
690 | << ')'; | - |
691 | | - |
692 | return dbg.space(); executed: return dbg.space(); Execution Count:1 | 1 |
693 | } | - |
694 | QPoint QTransform::map(const QPoint &p) const | - |
695 | { | - |
696 | qreal fx = p.x(); | - |
697 | qreal fy = p.y(); | - |
698 | | - |
699 | qreal x = 0, y = 0; | - |
700 | | - |
701 | TransformationType t = inline_type(); | - |
702 | switch(t) { | - |
703 | case TxNone: | - |
704 | x = fx; | - |
705 | y = fy; | - |
706 | break; | 0 |
707 | case TxTranslate: | - |
708 | x = fx + affine._dx; | - |
709 | y = fy + affine._dy; | - |
710 | break; | 0 |
711 | case TxScale: | - |
712 | x = affine._m11 * fx + affine._dx; | - |
713 | y = affine._m22 * fy + affine._dy; | - |
714 | break; | 0 |
715 | case TxRotate: | - |
716 | case TxShear: | - |
717 | case TxProject: | - |
718 | x = affine._m11 * fx + affine._m21 * fy + affine._dx; | - |
719 | y = affine._m12 * fx + affine._m22 * fy + affine._dy; | - |
720 | if (t == TxProject) { partially evaluated: t == TxProject no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
721 | qreal w = 1./(m_13 * fx + m_23 * fy + m_33); | - |
722 | x *= w; | - |
723 | y *= w; | - |
724 | } | 0 |
725 | } executed: } Execution Count:2 | 2 |
726 | return QPoint(qRound(x), qRound(y)); executed: return QPoint(qRound(x), qRound(y)); Execution Count:2 | 2 |
727 | } | - |
728 | QPointF QTransform::map(const QPointF &p) const | - |
729 | { | - |
730 | qreal fx = p.x(); | - |
731 | qreal fy = p.y(); | - |
732 | | - |
733 | qreal x = 0, y = 0; | - |
734 | | - |
735 | TransformationType t = inline_type(); | - |
736 | switch(t) { | - |
737 | case TxNone: | - |
738 | x = fx; | - |
739 | y = fy; | - |
740 | break; executed: break; Execution Count:41649 | 41649 |
741 | case TxTranslate: | - |
742 | x = fx + affine._dx; | - |
743 | y = fy + affine._dy; | - |
744 | break; executed: break; Execution Count:211099 | 211099 |
745 | case TxScale: | - |
746 | x = affine._m11 * fx + affine._dx; | - |
747 | y = affine._m22 * fy + affine._dy; | - |
748 | break; executed: break; Execution Count:4623 | 4623 |
749 | case TxRotate: | - |
750 | case TxShear: | - |
751 | case TxProject: | - |
752 | x = affine._m11 * fx + affine._m21 * fy + affine._dx; | - |
753 | y = affine._m12 * fx + affine._m22 * fy + affine._dy; | - |
754 | if (t == TxProject) { partially evaluated: t == TxProject no Evaluation Count:0 | yes Evaluation Count:9856 |
| 0-9856 |
755 | qreal w = 1./(m_13 * fx + m_23 * fy + m_33); | - |
756 | x *= w; | - |
757 | y *= w; | - |
758 | } | 0 |
759 | } executed: } Execution Count:9856 | 9856 |
760 | return QPointF(x, y); executed: return QPointF(x, y); Execution Count:267227 | 267227 |
761 | } | - |
762 | QLine QTransform::map(const QLine &l) const | - |
763 | { | - |
764 | qreal fx1 = l.x1(); | - |
765 | qreal fy1 = l.y1(); | - |
766 | qreal fx2 = l.x2(); | - |
767 | qreal fy2 = l.y2(); | - |
768 | | - |
769 | qreal x1 = 0, y1 = 0, x2 = 0, y2 = 0; | - |
770 | | - |
771 | TransformationType t = inline_type(); | - |
772 | switch(t) { | - |
773 | case TxNone: | - |
774 | x1 = fx1; | - |
775 | y1 = fy1; | - |
776 | x2 = fx2; | - |
777 | y2 = fy2; | - |
778 | break; | 0 |
779 | case TxTranslate: | - |
780 | x1 = fx1 + affine._dx; | - |
781 | y1 = fy1 + affine._dy; | - |
782 | x2 = fx2 + affine._dx; | - |
783 | y2 = fy2 + affine._dy; | - |
784 | break; | 0 |
785 | case TxScale: | - |
786 | x1 = affine._m11 * fx1 + affine._dx; | - |
787 | y1 = affine._m22 * fy1 + affine._dy; | - |
788 | x2 = affine._m11 * fx2 + affine._dx; | - |
789 | y2 = affine._m22 * fy2 + affine._dy; | - |
790 | break; | 0 |
791 | case TxRotate: | - |
792 | case TxShear: | - |
793 | case TxProject: | - |
794 | x1 = affine._m11 * fx1 + affine._m21 * fy1 + affine._dx; | - |
795 | y1 = affine._m12 * fx1 + affine._m22 * fy1 + affine._dy; | - |
796 | x2 = affine._m11 * fx2 + affine._m21 * fy2 + affine._dx; | - |
797 | y2 = affine._m12 * fx2 + affine._m22 * fy2 + affine._dy; | - |
798 | if (t == TxProject) { never evaluated: t == TxProject | 0 |
799 | qreal w = 1./(m_13 * fx1 + m_23 * fy1 + m_33); | - |
800 | x1 *= w; | - |
801 | y1 *= w; | - |
802 | w = 1./(m_13 * fx2 + m_23 * fy2 + m_33); | - |
803 | x2 *= w; | - |
804 | y2 *= w; | - |
805 | } | 0 |
806 | } | 0 |
807 | return QLine(qRound(x1), qRound(y1), qRound(x2), qRound(y2)); never executed: return QLine(qRound(x1), qRound(y1), qRound(x2), qRound(y2)); | 0 |
808 | } | - |
809 | QLineF QTransform::map(const QLineF &l) const | - |
810 | { | - |
811 | qreal fx1 = l.x1(); | - |
812 | qreal fy1 = l.y1(); | - |
813 | qreal fx2 = l.x2(); | - |
814 | qreal fy2 = l.y2(); | - |
815 | | - |
816 | qreal x1 = 0, y1 = 0, x2 = 0, y2 = 0; | - |
817 | | - |
818 | TransformationType t = inline_type(); | - |
819 | switch(t) { | - |
820 | case TxNone: | - |
821 | x1 = fx1; | - |
822 | y1 = fy1; | - |
823 | x2 = fx2; | - |
824 | y2 = fy2; | - |
825 | break; executed: break; Execution Count:111 | 111 |
826 | case TxTranslate: | - |
827 | x1 = fx1 + affine._dx; | - |
828 | y1 = fy1 + affine._dy; | - |
829 | x2 = fx2 + affine._dx; | - |
830 | y2 = fy2 + affine._dy; | - |
831 | break; executed: break; Execution Count:59 | 59 |
832 | case TxScale: | - |
833 | x1 = affine._m11 * fx1 + affine._dx; | - |
834 | y1 = affine._m22 * fy1 + affine._dy; | - |
835 | x2 = affine._m11 * fx2 + affine._dx; | - |
836 | y2 = affine._m22 * fy2 + affine._dy; | - |
837 | break; executed: break; Execution Count:25 | 25 |
838 | case TxRotate: | - |
839 | case TxShear: | - |
840 | case TxProject: | - |
841 | x1 = affine._m11 * fx1 + affine._m21 * fy1 + affine._dx; | - |
842 | y1 = affine._m12 * fx1 + affine._m22 * fy1 + affine._dy; | - |
843 | x2 = affine._m11 * fx2 + affine._m21 * fy2 + affine._dx; | - |
844 | y2 = affine._m12 * fx2 + affine._m22 * fy2 + affine._dy; | - |
845 | if (t == TxProject) { partially evaluated: t == TxProject no Evaluation Count:0 | yes Evaluation Count:705 |
| 0-705 |
846 | qreal w = 1./(m_13 * fx1 + m_23 * fy1 + m_33); | - |
847 | x1 *= w; | - |
848 | y1 *= w; | - |
849 | w = 1./(m_13 * fx2 + m_23 * fy2 + m_33); | - |
850 | x2 *= w; | - |
851 | y2 *= w; | - |
852 | } | 0 |
853 | } executed: } Execution Count:705 | 705 |
854 | return QLineF(x1, y1, x2, y2); executed: return QLineF(x1, y1, x2, y2); Execution Count:900 | 900 |
855 | } | - |
856 | | - |
857 | static QPolygonF mapProjective(const QTransform &transform, const QPolygonF &poly) | - |
858 | { | - |
859 | if (poly.size() == 0) partially evaluated: poly.size() == 0 no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
860 | return poly; never executed: return poly; | 0 |
861 | | - |
862 | if (poly.size() == 1) partially evaluated: poly.size() == 1 no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
863 | return QPolygonF() << transform.map(poly.at(0)); never executed: return QPolygonF() << transform.map(poly.at(0)); | 0 |
864 | | - |
865 | QPainterPath path; | - |
866 | path.addPolygon(poly); | - |
867 | | - |
868 | path = transform.map(path); | - |
869 | | - |
870 | QPolygonF result; | - |
871 | for (int i = 0; i < path.elementCount(); ++i) evaluated: i < path.elementCount() yes Evaluation Count:10 | yes Evaluation Count:2 |
| 2-10 |
872 | result << path.elementAt(i); executed: result << path.elementAt(i); Execution Count:10 | 10 |
873 | return result; executed: return result; Execution Count:2 | 2 |
874 | } | - |
875 | QPolygonF QTransform::map(const QPolygonF &a) const | - |
876 | { | - |
877 | TransformationType t = inline_type(); | - |
878 | if (t <= TxTranslate) partially evaluated: t <= TxTranslate no Evaluation Count:0 | yes Evaluation Count:5 |
| 0-5 |
879 | return a.translated(affine._dx, affine._dy); never executed: return a.translated(affine._dx, affine._dy); | 0 |
880 | | - |
881 | if (t >= QTransform::TxProject) evaluated: t >= QTransform::TxProject yes Evaluation Count:2 | yes Evaluation Count:3 |
| 2-3 |
882 | return mapProjective(*this, a); executed: return mapProjective(*this, a); Execution Count:2 | 2 |
883 | | - |
884 | int size = a.size(); | - |
885 | int i; | - |
886 | QPolygonF p(size); | - |
887 | const QPointF *da = a.constData(); | - |
888 | QPointF *dp = p.data(); | - |
889 | | - |
890 | for(i = 0; i < size; ++i) { evaluated: i < size yes Evaluation Count:15 | yes Evaluation Count:3 |
| 3-15 |
891 | do { qreal FX_ = da[i].xp; qreal FY_ = da[i].yp; switch(t) { case TxNone: dp[i].xp = FX_; dp[i].yp = FY_; break; case TxTranslate: dp[i].xp = FX_ + affine._dx; dp[i].yp = FY_ + affine._dy; break; case TxScale: dp[i].xp = affine._m11 * FX_ + affine._dx; dp[i].yp = affine._m22 * FY_ + affine._dy; break; case TxRotate: case TxShear: case TxProject: dp[i].xp = affine._m11 * FX_ + affine._m21 * FY_ + affine._dx; dp[i].yp = affine._m12 * FX_ + affine._m22 * FY_ + affine._dy; if (t == TxProject) { qreal w = (m_13 * FX_ + m_23 * FY_ + m_33); if (w < qreal((sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001))) w = qreal((sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001)); w = 1./w; dp[i].xp *= w; dp[i].yp *= w; } } } while (0); never executed: w = qreal((sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001)); executed: } Execution Count:15 executed: } Execution Count:15 partially evaluated: t == TxProject no Evaluation Count:0 | yes Evaluation Count:15 |
never evaluated: w < qreal((sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001)) partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:15 |
| 0-15 |
892 | } executed: } Execution Count:15 | 15 |
893 | return p; executed: return p; Execution Count:3 | 3 |
894 | } | - |
895 | QPolygon QTransform::map(const QPolygon &a) const | - |
896 | { | - |
897 | TransformationType t = inline_type(); | - |
898 | if (t <= TxTranslate) never evaluated: t <= TxTranslate | 0 |
899 | return a.translated(qRound(affine._dx), qRound(affine._dy)); never executed: return a.translated(qRound(affine._dx), qRound(affine._dy)); | 0 |
900 | | - |
901 | if (t >= QTransform::TxProject) never evaluated: t >= QTransform::TxProject | 0 |
902 | return mapProjective(*this, QPolygonF(a)).toPolygon(); never executed: return mapProjective(*this, QPolygonF(a)).toPolygon(); | 0 |
903 | | - |
904 | int size = a.size(); | - |
905 | int i; | - |
906 | QPolygon p(size); | - |
907 | const QPoint *da = a.constData(); | - |
908 | QPoint *dp = p.data(); | - |
909 | | - |
910 | for(i = 0; i < size; ++i) { never evaluated: i < size | 0 |
911 | qreal nx = 0, ny = 0; | - |
912 | do { qreal FX_ = da[i].xp; qreal FY_ = da[i].yp; switch(t) { case TxNone: nx = FX_; ny = FY_; break; case TxTranslate: nx = FX_ + affine._dx; ny = FY_ + affine._dy; break; case TxScale: nx = affine._m11 * FX_ + affine._dx; ny = affine._m22 * FY_ + affine._dy; break; case TxRotate: case TxShear: case TxProject: nx = affine._m11 * FX_ + affine._m21 * FY_ + affine._dx; ny = affine._m12 * FX_ + affine._m22 * FY_ + affine._dy; if (t == TxProject) { qreal w = (m_13 * FX_ + m_23 * FY_ + m_33); if (w < qreal((sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001))) w = qreal((sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001)); w = 1./w; nx *= w; ny *= w; } } } while (0); never executed: w = qreal((sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001)); never evaluated: t == TxProject never evaluated: w < qreal((sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001)) | 0 |
913 | dp[i].xp = qRound(nx); | - |
914 | dp[i].yp = qRound(ny); | - |
915 | } | 0 |
916 | return p; never executed: return p; | 0 |
917 | } | - |
918 | extern QPainterPath qt_regionToPath(const QRegion ®ion); | - |
919 | QRegion QTransform::map(const QRegion &r) const | - |
920 | { | - |
921 | TransformationType t = inline_type(); | - |
922 | if (t == TxNone) evaluated: t == TxNone yes Evaluation Count:252 | yes Evaluation Count:2038 |
| 252-2038 |
923 | return r; executed: return r; Execution Count:252 | 252 |
924 | | - |
925 | if (t == TxTranslate) { evaluated: t == TxTranslate yes Evaluation Count:2031 | yes Evaluation Count:7 |
| 7-2031 |
926 | QRegion copy(r); | - |
927 | copy.translate(qRound(affine._dx), qRound(affine._dy)); | - |
928 | return copy; executed: return copy; Execution Count:2031 | 2031 |
929 | } | - |
930 | | - |
931 | if (t == TxScale && r.rectCount() == 1) partially evaluated: t == TxScale no Evaluation Count:0 | yes Evaluation Count:7 |
never evaluated: r.rectCount() == 1 | 0-7 |
932 | return QRegion(mapRect(r.boundingRect())); never executed: return QRegion(mapRect(r.boundingRect())); | 0 |
933 | | - |
934 | QPainterPath p = map(qt_regionToPath(r)); | - |
935 | return p.toFillPolygon(QTransform()).toPolygon(); executed: return p.toFillPolygon(QTransform()).toPolygon(); Execution Count:7 | 7 |
936 | } | - |
937 | | - |
938 | struct QHomogeneousCoordinate | - |
939 | { | - |
940 | qreal x; | - |
941 | qreal y; | - |
942 | qreal w; | - |
943 | | - |
944 | QHomogeneousCoordinate() {} | - |
945 | QHomogeneousCoordinate(qreal x_, qreal y_, qreal w_) : x(x_), y(y_), w(w_) {} | 0 |
946 | | - |
947 | const QPointF toPoint() const { | - |
948 | qreal iw = 1. / w; | - |
949 | return QPointF(x * iw, y * iw); executed: return QPointF(x * iw, y * iw); Execution Count:126 | 126 |
950 | } | - |
951 | }; | - |
952 | | - |
953 | static inline QHomogeneousCoordinate mapHomogeneous(const QTransform &transform, const QPointF &p) | - |
954 | { | - |
955 | QHomogeneousCoordinate c; | - |
956 | c.x = transform.m11() * p.x() + transform.m21() * p.y() + transform.m31(); | - |
957 | c.y = transform.m12() * p.x() + transform.m22() * p.y() + transform.m32(); | - |
958 | c.w = transform.m13() * p.x() + transform.m23() * p.y() + transform.m33(); | - |
959 | return c; executed: return c; Execution Count:208 | 208 |
960 | } | - |
961 | | - |
962 | static inline bool lineTo_clipped(QPainterPath &path, const QTransform &transform, const QPointF &a, const QPointF &b, | - |
963 | bool needsMoveTo, bool needsLineTo = true) | - |
964 | { | - |
965 | QHomogeneousCoordinate ha = mapHomogeneous(transform, a); | - |
966 | QHomogeneousCoordinate hb = mapHomogeneous(transform, b); | - |
967 | | - |
968 | if (ha.w < (sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001) && hb.w < (sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001)) evaluated: ha.w < (sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001) yes Evaluation Count:8 | yes Evaluation Count:96 |
evaluated: hb.w < (sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001) yes Evaluation Count:4 | yes Evaluation Count:4 |
| 4-96 |
969 | return false; executed: return false; Execution Count:4 | 4 |
970 | | - |
971 | if (hb.w < (sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001)) { evaluated: hb.w < (sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001) yes Evaluation Count:4 | yes Evaluation Count:96 |
| 4-96 |
972 | const qreal t = ((sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001) - hb.w) / (ha.w - hb.w); partially evaluated: sizeof(qreal) == sizeof(double) yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
973 | | - |
974 | hb.x += (ha.x - hb.x) * t; | - |
975 | hb.y += (ha.y - hb.y) * t; | - |
976 | hb.w = qreal((sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001)); | - |
977 | } else if (ha.w < (sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001)) { executed: } Execution Count:4 evaluated: ha.w < (sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001) yes Evaluation Count:4 | yes Evaluation Count:92 |
| 4-92 |
978 | const qreal t = ((sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001) - ha.w) / (hb.w - ha.w); partially evaluated: sizeof(qreal) == sizeof(double) yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
979 | | - |
980 | ha.x += (hb.x - ha.x) * t; | - |
981 | ha.y += (hb.y - ha.y) * t; | - |
982 | ha.w = qreal((sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001)); | - |
983 | | - |
984 | const QPointF p = ha.toPoint(); | - |
985 | if (needsMoveTo) { partially evaluated: needsMoveTo yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
986 | path.moveTo(p); | - |
987 | needsMoveTo = false; | - |
988 | } else { executed: } Execution Count:4 | 4 |
989 | path.lineTo(p); | - |
990 | } | 0 |
991 | } | - |
992 | | - |
993 | if (needsMoveTo) evaluated: needsMoveTo yes Evaluation Count:22 | yes Evaluation Count:78 |
| 22-78 |
994 | path.moveTo(ha.toPoint()); executed: path.moveTo(ha.toPoint()); Execution Count:22 | 22 |
995 | | - |
996 | if (needsLineTo) partially evaluated: needsLineTo yes Evaluation Count:100 | no Evaluation Count:0 |
| 0-100 |
997 | path.lineTo(hb.toPoint()); executed: path.lineTo(hb.toPoint()); Execution Count:100 | 100 |
998 | | - |
999 | return true; executed: return true; Execution Count:100 | 100 |
1000 | } | - |
1001 | __attribute__((visibility("default"))) bool qt_scaleForTransform(const QTransform &transform, qreal *scale); | - |
1002 | | - |
1003 | static inline bool cubicTo_clipped(QPainterPath &path, const QTransform &transform, const QPointF &a, const QPointF &b, const QPointF &c, const QPointF &d, bool needsMoveTo) | - |
1004 | { | - |
1005 | | - |
1006 | | - |
1007 | | - |
1008 | qreal scale; | - |
1009 | qt_scaleForTransform(transform, &scale); | - |
1010 | | - |
1011 | qreal curveThreshold = scale == 0 ? qreal(0.25) : (qreal(0.25) / scale); never evaluated: scale == 0 | 0 |
1012 | | - |
1013 | QPolygonF segment = QBezier::fromPoints(a, b, c, d).toPolygon(curveThreshold); | - |
1014 | | - |
1015 | for (int i = 0; i < segment.size() - 1; ++i) never evaluated: i < segment.size() - 1 | 0 |
1016 | if (lineTo_clipped(path, transform, segment.at(i), segment.at(i+1), needsMoveTo)) never evaluated: lineTo_clipped(path, transform, segment.at(i), segment.at(i+1), needsMoveTo) | 0 |
1017 | needsMoveTo = false; never executed: needsMoveTo = false; | 0 |
1018 | | - |
1019 | return !needsMoveTo; never executed: return !needsMoveTo; | 0 |
1020 | } | - |
1021 | | - |
1022 | static QPainterPath mapProjective(const QTransform &transform, const QPainterPath &path) | - |
1023 | { | - |
1024 | QPainterPath result; | - |
1025 | | - |
1026 | QPointF last; | - |
1027 | QPointF lastMoveTo; | - |
1028 | bool needsMoveTo = true; | - |
1029 | for (int i = 0; i < path.elementCount(); ++i) { evaluated: i < path.elementCount() yes Evaluation Count:130 | yes Evaluation Count:26 |
| 26-130 |
1030 | switch (path.elementAt(i).type) { | - |
1031 | case QPainterPath::MoveToElement: | - |
1032 | if (i > 0 && lastMoveTo != last) partially evaluated: i > 0 no Evaluation Count:0 | yes Evaluation Count:26 |
never evaluated: lastMoveTo != last | 0-26 |
1033 | lineTo_clipped(result, transform, last, lastMoveTo, needsMoveTo); never executed: lineTo_clipped(result, transform, last, lastMoveTo, needsMoveTo); | 0 |
1034 | | - |
1035 | lastMoveTo = path.elementAt(i); | - |
1036 | last = path.elementAt(i); | - |
1037 | needsMoveTo = true; | - |
1038 | break; executed: break; Execution Count:26 | 26 |
1039 | case QPainterPath::LineToElement: | - |
1040 | if (lineTo_clipped(result, transform, last, path.elementAt(i), needsMoveTo)) evaluated: lineTo_clipped(result, transform, last, path.elementAt(i), needsMoveTo) yes Evaluation Count:100 | yes Evaluation Count:4 |
| 4-100 |
1041 | needsMoveTo = false; executed: needsMoveTo = false; Execution Count:100 | 100 |
1042 | last = path.elementAt(i); | - |
1043 | break; executed: break; Execution Count:104 | 104 |
1044 | case QPainterPath::CurveToElement: | - |
1045 | if (cubicTo_clipped(result, transform, last, path.elementAt(i), path.elementAt(i+1), path.elementAt(i+2), needsMoveTo)) never evaluated: cubicTo_clipped(result, transform, last, path.elementAt(i), path.elementAt(i+1), path.elementAt(i+2), needsMoveTo) | 0 |
1046 | needsMoveTo = false; never executed: needsMoveTo = false; | 0 |
1047 | i += 2; | - |
1048 | last = path.elementAt(i); | - |
1049 | break; | 0 |
1050 | default: | - |
1051 | qt_noop(); | - |
1052 | } | 0 |
1053 | } executed: } Execution Count:130 | 130 |
1054 | | - |
1055 | if (path.elementCount() > 0 && lastMoveTo != last) partially evaluated: path.elementCount() > 0 yes Evaluation Count:26 | no Evaluation Count:0 |
partially evaluated: lastMoveTo != last no Evaluation Count:0 | yes Evaluation Count:26 |
| 0-26 |
1056 | lineTo_clipped(result, transform, last, lastMoveTo, needsMoveTo, false); never executed: lineTo_clipped(result, transform, last, lastMoveTo, needsMoveTo, false); | 0 |
1057 | | - |
1058 | result.setFillRule(path.fillRule()); | - |
1059 | return result; executed: return result; Execution Count:26 | 26 |
1060 | } | - |
1061 | QPainterPath QTransform::map(const QPainterPath &path) const | - |
1062 | { | - |
1063 | TransformationType t = inline_type(); | - |
1064 | if (t == TxNone || path.elementCount() == 0) evaluated: t == TxNone yes Evaluation Count:17 | yes Evaluation Count:79 |
partially evaluated: path.elementCount() == 0 no Evaluation Count:0 | yes Evaluation Count:79 |
| 0-79 |
1065 | return path; executed: return path; Execution Count:17 | 17 |
1066 | | - |
1067 | if (t >= TxProject) evaluated: t >= TxProject yes Evaluation Count:26 | yes Evaluation Count:53 |
| 26-53 |
1068 | return mapProjective(*this, path); executed: return mapProjective(*this, path); Execution Count:26 | 26 |
1069 | | - |
1070 | QPainterPath copy = path; | - |
1071 | | - |
1072 | if (t == TxTranslate) { evaluated: t == TxTranslate yes Evaluation Count:8 | yes Evaluation Count:45 |
| 8-45 |
1073 | copy.translate(affine._dx, affine._dy); | - |
1074 | } else { executed: } Execution Count:8 | 8 |
1075 | copy.detach(); | - |
1076 | | - |
1077 | for (int i=0; i<path.elementCount(); ++i) { evaluated: i<path.elementCount() yes Evaluation Count:415 | yes Evaluation Count:45 |
| 45-415 |
1078 | QPainterPath::Element &e = copy.d_ptr->elements[i]; | - |
1079 | do { qreal FX_ = e.x; qreal FY_ = e.y; switch(t) { case TxNone: e.x = FX_; e.y = FY_; break; case TxTranslate: e.x = FX_ + affine._dx; e.y = FY_ + affine._dy; break; case TxScale: e.x = affine._m11 * FX_ + affine._dx; e.y = affine._m22 * FY_ + affine._dy; break; case TxRotate: case TxShear: case TxProject: e.x = affine._m11 * FX_ + affine._m21 * FY_ + affine._dx; e.y = affine._m12 * FX_ + affine._m22 * FY_ + affine._dy; if (t == TxProject) { qreal w = (m_13 * FX_ + m_23 * FY_ + m_33); if (w < qreal((sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001))) w = qreal((sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001)); w = 1./w; e.x *= w; e.y *= w; } } } while (0); executed: break; Execution Count:10 never executed: w = qreal((sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001)); executed: } Execution Count:405 executed: } Execution Count:415 partially evaluated: t == TxProject no Evaluation Count:0 | yes Evaluation Count:405 |
never evaluated: w < qreal((sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001)) partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:415 |
| 0-415 |
1080 | } executed: } Execution Count:415 | 415 |
1081 | } executed: } Execution Count:45 | 45 |
1082 | | - |
1083 | return copy; executed: return copy; Execution Count:53 | 53 |
1084 | } | - |
1085 | QPolygon QTransform::mapToPolygon(const QRect &rect) const | - |
1086 | { | - |
1087 | TransformationType t = inline_type(); | - |
1088 | | - |
1089 | QPolygon a(4); | - |
1090 | qreal x[4] = { 0, 0, 0, 0 }, y[4] = { 0, 0, 0, 0 }; | - |
1091 | if (t <= TxScale) { evaluated: t <= TxScale yes Evaluation Count:19 | yes Evaluation Count:10 |
| 10-19 |
1092 | x[0] = affine._m11*rect.x() + affine._dx; | - |
1093 | y[0] = affine._m22*rect.y() + affine._dy; | - |
1094 | qreal w = affine._m11*rect.width(); | - |
1095 | qreal h = affine._m22*rect.height(); | - |
1096 | if (w < 0) { evaluated: w < 0 yes Evaluation Count:12 | yes Evaluation Count:7 |
| 7-12 |
1097 | w = -w; | - |
1098 | x[0] -= w; | - |
1099 | } executed: } Execution Count:12 | 12 |
1100 | if (h < 0) { evaluated: h < 0 yes Evaluation Count:12 | yes Evaluation Count:7 |
| 7-12 |
1101 | h = -h; | - |
1102 | y[0] -= h; | - |
1103 | } executed: } Execution Count:12 | 12 |
1104 | x[1] = x[0]+w; | - |
1105 | x[2] = x[1]; | - |
1106 | x[3] = x[0]; | - |
1107 | y[1] = y[0]; | - |
1108 | y[2] = y[0]+h; | - |
1109 | y[3] = y[2]; | - |
1110 | } else { executed: } Execution Count:19 | 19 |
1111 | qreal right = rect.x() + rect.width(); | - |
1112 | qreal bottom = rect.y() + rect.height(); | - |
1113 | do { qreal FX_ = rect.x(); qreal FY_ = rect.y(); switch(t) { case TxNone: x[0] = FX_; y[0] = FY_; break; case TxTranslate: x[0] = FX_ + affine._dx; y[0] = FY_ + affine._dy; break; case TxScale: x[0] = affine._m11 * FX_ + affine._dx; y[0] = affine._m22 * FY_ + affine._dy; break; case TxRotate: case TxShear: case TxProject: x[0] = affine._m11 * FX_ + affine._m21 * FY_ + affine._dx; y[0] = affine._m12 * FX_ + affine._m22 * FY_ + affine._dy; if (t == TxProject) { qreal w = (m_13 * FX_ + m_23 * FY_ + m_33); if (w < qreal((sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001))) w = qreal((sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001)); w = 1./w; x[0] *= w; y[0] *= w; } } } while (0); never executed: w = qreal((sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001)); executed: } Execution Count:10 executed: } Execution Count:10 partially evaluated: t == TxProject no Evaluation Count:0 | yes Evaluation Count:10 |
never evaluated: w < qreal((sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001)) partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:10 |
| 0-10 |
1114 | do { qreal FX_ = right; qreal FY_ = rect.y(); switch(t) { case TxNone: x[1] = FX_; y[1] = FY_; break; case TxTranslate: x[1] = FX_ + affine._dx; y[1] = FY_ + affine._dy; break; case TxScale: x[1] = affine._m11 * FX_ + affine._dx; y[1] = affine._m22 * FY_ + affine._dy; break; case TxRotate: case TxShear: case TxProject: x[1] = affine._m11 * FX_ + affine._m21 * FY_ + affine._dx; y[1] = affine._m12 * FX_ + affine._m22 * FY_ + affine._dy; if (t == TxProject) { qreal w = (m_13 * FX_ + m_23 * FY_ + m_33); if (w < qreal((sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001))) w = qreal((sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001)); w = 1./w; x[1] *= w; y[1] *= w; } } } while (0); never executed: w = qreal((sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001)); executed: } Execution Count:10 executed: } Execution Count:10 partially evaluated: t == TxProject no Evaluation Count:0 | yes Evaluation Count:10 |
never evaluated: w < qreal((sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001)) partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:10 |
| 0-10 |
1115 | do { qreal FX_ = right; qreal FY_ = bottom; switch(t) { case TxNone: x[2] = FX_; y[2] = FY_; break; case TxTranslate: x[2] = FX_ + affine._dx; y[2] = FY_ + affine._dy; break; case TxScale: x[2] = affine._m11 * FX_ + affine._dx; y[2] = affine._m22 * FY_ + affine._dy; break; case TxRotate: case TxShear: case TxProject: x[2] = affine._m11 * FX_ + affine._m21 * FY_ + affine._dx; y[2] = affine._m12 * FX_ + affine._m22 * FY_ + affine._dy; if (t == TxProject) { qreal w = (m_13 * FX_ + m_23 * FY_ + m_33); if (w < qreal((sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001))) w = qreal((sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001)); w = 1./w; x[2] *= w; y[2] *= w; } } } while (0); never executed: w = qreal((sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001)); executed: } Execution Count:10 executed: } Execution Count:10 partially evaluated: t == TxProject no Evaluation Count:0 | yes Evaluation Count:10 |
never evaluated: w < qreal((sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001)) partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:10 |
| 0-10 |
1116 | do { qreal FX_ = rect.x(); qreal FY_ = bottom; switch(t) { case TxNone: x[3] = FX_; y[3] = FY_; break; case TxTranslate: x[3] = FX_ + affine._dx; y[3] = FY_ + affine._dy; break; case TxScale: x[3] = affine._m11 * FX_ + affine._dx; y[3] = affine._m22 * FY_ + affine._dy; break; case TxRotate: case TxShear: case TxProject: x[3] = affine._m11 * FX_ + affine._m21 * FY_ + affine._dx; y[3] = affine._m12 * FX_ + affine._m22 * FY_ + affine._dy; if (t == TxProject) { qreal w = (m_13 * FX_ + m_23 * FY_ + m_33); if (w < qreal((sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001))) w = qreal((sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001)); w = 1./w; x[3] *= w; y[3] *= w; } } } while (0); never executed: w = qreal((sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001)); executed: } Execution Count:10 executed: } Execution Count:10 partially evaluated: t == TxProject no Evaluation Count:0 | yes Evaluation Count:10 |
never evaluated: w < qreal((sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001)) partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:10 |
| 0-10 |
1117 | } executed: } Execution Count:10 | 10 |
1118 | | - |
1119 | | - |
1120 | | - |
1121 | a.setPoints(4, qRound(x[0]), qRound(y[0]), | - |
1122 | qRound(x[1]), qRound(y[1]), | - |
1123 | qRound(x[2]), qRound(y[2]), | - |
1124 | qRound(x[3]), qRound(y[3])); | - |
1125 | return a; executed: return a; Execution Count:29 | 29 |
1126 | } | - |
1127 | bool QTransform::squareToQuad(const QPolygonF &quad, QTransform &trans) | - |
1128 | { | - |
1129 | if (quad.count() != 4) never evaluated: quad.count() != 4 | 0 |
1130 | return false; never executed: return false; | 0 |
1131 | | - |
1132 | qreal dx0 = quad[0].x(); | - |
1133 | qreal dx1 = quad[1].x(); | - |
1134 | qreal dx2 = quad[2].x(); | - |
1135 | qreal dx3 = quad[3].x(); | - |
1136 | | - |
1137 | qreal dy0 = quad[0].y(); | - |
1138 | qreal dy1 = quad[1].y(); | - |
1139 | qreal dy2 = quad[2].y(); | - |
1140 | qreal dy3 = quad[3].y(); | - |
1141 | | - |
1142 | double ax = dx0 - dx1 + dx2 - dx3; | - |
1143 | double ay = dy0 - dy1 + dy2 - dy3; | - |
1144 | | - |
1145 | if (!ax && !ay) { | 0 |
1146 | trans.setMatrix(dx1 - dx0, dy1 - dy0, 0, | - |
1147 | dx2 - dx1, dy2 - dy1, 0, | - |
1148 | dx0, dy0, 1); | - |
1149 | } else { | 0 |
1150 | double ax1 = dx1 - dx2; | - |
1151 | double ax2 = dx3 - dx2; | - |
1152 | double ay1 = dy1 - dy2; | - |
1153 | double ay2 = dy3 - dy2; | - |
1154 | | - |
1155 | | - |
1156 | double gtop = ax * ay2 - ax2 * ay; | - |
1157 | double htop = ax1 * ay - ax * ay1; | - |
1158 | double bottom = ax1 * ay2 - ax2 * ay1; | - |
1159 | | - |
1160 | double a, b, c, d, e, f, g, h; | - |
1161 | | - |
1162 | if (!bottom) | 0 |
1163 | return false; never executed: return false; | 0 |
1164 | | - |
1165 | g = gtop/bottom; | - |
1166 | h = htop/bottom; | - |
1167 | | - |
1168 | a = dx1 - dx0 + g * dx1; | - |
1169 | b = dx3 - dx0 + h * dx3; | - |
1170 | c = dx0; | - |
1171 | d = dy1 - dy0 + g * dy1; | - |
1172 | e = dy3 - dy0 + h * dy3; | - |
1173 | f = dy0; | - |
1174 | | - |
1175 | trans.setMatrix(a, d, g, | - |
1176 | b, e, h, | - |
1177 | c, f, 1.0); | - |
1178 | } | 0 |
1179 | | - |
1180 | return true; never executed: return true; | 0 |
1181 | } | - |
1182 | bool QTransform::quadToSquare(const QPolygonF &quad, QTransform &trans) | - |
1183 | { | - |
1184 | if (!squareToQuad(quad, trans)) never evaluated: !squareToQuad(quad, trans) | 0 |
1185 | return false; never executed: return false; | 0 |
1186 | | - |
1187 | bool invertible = false; | - |
1188 | trans = trans.inverted(&invertible); | - |
1189 | | - |
1190 | return invertible; never executed: return invertible; | 0 |
1191 | } | - |
1192 | bool QTransform::quadToQuad(const QPolygonF &one, | - |
1193 | const QPolygonF &two, | - |
1194 | QTransform &trans) | - |
1195 | { | - |
1196 | QTransform stq; | - |
1197 | if (!quadToSquare(one, trans)) never evaluated: !quadToSquare(one, trans) | 0 |
1198 | return false; never executed: return false; | 0 |
1199 | if (!squareToQuad(two, stq)) never evaluated: !squareToQuad(two, stq) | 0 |
1200 | return false; never executed: return false; | 0 |
1201 | trans *= stq; | - |
1202 | | - |
1203 | return true; never executed: return true; | 0 |
1204 | } | - |
1205 | void QTransform::setMatrix(qreal m11, qreal m12, qreal m13, | - |
1206 | qreal m21, qreal m22, qreal m23, | - |
1207 | qreal m31, qreal m32, qreal m33) | - |
1208 | { | - |
1209 | affine._m11 = m11; affine._m12 = m12; m_13 = m13; | - |
1210 | affine._m21 = m21; affine._m22 = m22; m_23 = m23; | - |
1211 | affine._dx = m31; affine._dy = m32; m_33 = m33; | - |
1212 | m_type = TxNone; | - |
1213 | m_dirty = TxProject; | - |
1214 | } executed: } Execution Count:753 | 753 |
1215 | | - |
1216 | static inline bool needsPerspectiveClipping(const QRectF &rect, const QTransform &transform) | - |
1217 | { | - |
1218 | const qreal wx = qMin(transform.m13() * rect.left(), transform.m13() * rect.right()); | - |
1219 | const qreal wy = qMin(transform.m23() * rect.top(), transform.m23() * rect.bottom()); | - |
1220 | | - |
1221 | return wx + wy + transform.m33() < (sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001); executed: return wx + wy + transform.m33() < (sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001); Execution Count:28 | 28 |
1222 | } | - |
1223 | | - |
1224 | QRect QTransform::mapRect(const QRect &rect) const | - |
1225 | { | - |
1226 | TransformationType t = inline_type(); | - |
1227 | if (t <= TxTranslate) evaluated: t <= TxTranslate yes Evaluation Count:21730 | yes Evaluation Count:53 |
| 53-21730 |
1228 | return rect.translated(qRound(affine._dx), qRound(affine._dy)); executed: return rect.translated(qRound(affine._dx), qRound(affine._dy)); Execution Count:21730 | 21730 |
1229 | | - |
1230 | if (t <= TxScale) { evaluated: t <= TxScale yes Evaluation Count:33 | yes Evaluation Count:20 |
| 20-33 |
1231 | int x = qRound(affine._m11*rect.x() + affine._dx); | - |
1232 | int y = qRound(affine._m22*rect.y() + affine._dy); | - |
1233 | int w = qRound(affine._m11*rect.width()); | - |
1234 | int h = qRound(affine._m22*rect.height()); | - |
1235 | if (w < 0) { evaluated: w < 0 yes Evaluation Count:13 | yes Evaluation Count:20 |
| 13-20 |
1236 | w = -w; | - |
1237 | x -= w; | - |
1238 | } executed: } Execution Count:13 | 13 |
1239 | if (h < 0) { evaluated: h < 0 yes Evaluation Count:13 | yes Evaluation Count:20 |
| 13-20 |
1240 | h = -h; | - |
1241 | y -= h; | - |
1242 | } executed: } Execution Count:13 | 13 |
1243 | return QRect(x, y, w, h); executed: return QRect(x, y, w, h); Execution Count:33 | 33 |
1244 | } else if (t < TxProject || !needsPerspectiveClipping(rect, *this)) { partially evaluated: t < TxProject yes Evaluation Count:20 | no Evaluation Count:0 |
never evaluated: !needsPerspectiveClipping(rect, *this) | 0-20 |
1245 | | - |
1246 | qreal x = 0, y = 0; | - |
1247 | do { qreal FX_ = rect.left(); qreal FY_ = rect.top(); switch(t) { case TxNone: x = FX_; y = FY_; break; case TxTranslate: x = FX_ + affine._dx; y = FY_ + affine._dy; break; case TxScale: x = affine._m11 * FX_ + affine._dx; y = affine._m22 * FY_ + affine._dy; break; case TxRotate: case TxShear: case TxProject: x = affine._m11 * FX_ + affine._m21 * FY_ + affine._dx; y = affine._m12 * FX_ + affine._m22 * FY_ + affine._dy; if (t == TxProject) { qreal w = (m_13 * FX_ + m_23 * FY_ + m_33); if (w < qreal((sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001))) w = qreal((sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001)); w = 1./w; x *= w; y *= w; } } } while (0); never executed: w = qreal((sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001)); executed: } Execution Count:20 executed: } Execution Count:20 partially evaluated: t == TxProject no Evaluation Count:0 | yes Evaluation Count:20 |
never evaluated: w < qreal((sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001)) partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:20 |
| 0-20 |
1248 | qreal xmin = x; | - |
1249 | qreal ymin = y; | - |
1250 | qreal xmax = x; | - |
1251 | qreal ymax = y; | - |
1252 | do { qreal FX_ = rect.right() + 1; qreal FY_ = rect.top(); switch(t) { case TxNone: x = FX_; y = FY_; break; case TxTranslate: x = FX_ + affine._dx; y = FY_ + affine._dy; break; case TxScale: x = affine._m11 * FX_ + affine._dx; y = affine._m22 * FY_ + affine._dy; break; case TxRotate: case TxShear: case TxProject: x = affine._m11 * FX_ + affine._m21 * FY_ + affine._dx; y = affine._m12 * FX_ + affine._m22 * FY_ + affine._dy; if (t == TxProject) { qreal w = (m_13 * FX_ + m_23 * FY_ + m_33); if (w < qreal((sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001))) w = qreal((sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001)); w = 1./w; x *= w; y *= w; } } } while (0); never executed: w = qreal((sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001)); executed: } Execution Count:20 executed: } Execution Count:20 partially evaluated: t == TxProject no Evaluation Count:0 | yes Evaluation Count:20 |
never evaluated: w < qreal((sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001)) partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:20 |
| 0-20 |
1253 | xmin = qMin(xmin, x); | - |
1254 | ymin = qMin(ymin, y); | - |
1255 | xmax = qMax(xmax, x); | - |
1256 | ymax = qMax(ymax, y); | - |
1257 | do { qreal FX_ = rect.right() + 1; qreal FY_ = rect.bottom() + 1; switch(t) { case TxNone: x = FX_; y = FY_; break; case TxTranslate: x = FX_ + affine._dx; y = FY_ + affine._dy; break; case TxScale: x = affine._m11 * FX_ + affine._dx; y = affine._m22 * FY_ + affine._dy; break; case TxRotate: case TxShear: case TxProject: x = affine._m11 * FX_ + affine._m21 * FY_ + affine._dx; y = affine._m12 * FX_ + affine._m22 * FY_ + affine._dy; if (t == TxProject) { qreal w = (m_13 * FX_ + m_23 * FY_ + m_33); if (w < qreal((sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001))) w = qreal((sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001)); w = 1./w; x *= w; y *= w; } } } while (0); never executed: w = qreal((sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001)); executed: } Execution Count:20 executed: } Execution Count:20 partially evaluated: t == TxProject no Evaluation Count:0 | yes Evaluation Count:20 |
never evaluated: w < qreal((sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001)) partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:20 |
| 0-20 |
1258 | xmin = qMin(xmin, x); | - |
1259 | ymin = qMin(ymin, y); | - |
1260 | xmax = qMax(xmax, x); | - |
1261 | ymax = qMax(ymax, y); | - |
1262 | do { qreal FX_ = rect.left(); qreal FY_ = rect.bottom() + 1; switch(t) { case TxNone: x = FX_; y = FY_; break; case TxTranslate: x = FX_ + affine._dx; y = FY_ + affine._dy; break; case TxScale: x = affine._m11 * FX_ + affine._dx; y = affine._m22 * FY_ + affine._dy; break; case TxRotate: case TxShear: case TxProject: x = affine._m11 * FX_ + affine._m21 * FY_ + affine._dx; y = affine._m12 * FX_ + affine._m22 * FY_ + affine._dy; if (t == TxProject) { qreal w = (m_13 * FX_ + m_23 * FY_ + m_33); if (w < qreal((sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001))) w = qreal((sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001)); w = 1./w; x *= w; y *= w; } } } while (0); never executed: w = qreal((sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001)); executed: } Execution Count:20 executed: } Execution Count:20 partially evaluated: t == TxProject no Evaluation Count:0 | yes Evaluation Count:20 |
never evaluated: w < qreal((sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001)) partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:20 |
| 0-20 |
1263 | xmin = qMin(xmin, x); | - |
1264 | ymin = qMin(ymin, y); | - |
1265 | xmax = qMax(xmax, x); | - |
1266 | ymax = qMax(ymax, y); | - |
1267 | return QRect(qRound(xmin), qRound(ymin), qRound(xmax)-qRound(xmin), qRound(ymax)-qRound(ymin)); executed: return QRect(qRound(xmin), qRound(ymin), qRound(xmax)-qRound(xmin), qRound(ymax)-qRound(ymin)); Execution Count:20 | 20 |
1268 | } else { | - |
1269 | QPainterPath path; | - |
1270 | path.addRect(rect); | - |
1271 | return map(path).boundingRect().toRect(); never executed: return map(path).boundingRect().toRect(); | 0 |
1272 | } | - |
1273 | } | - |
1274 | QRectF QTransform::mapRect(const QRectF &rect) const | - |
1275 | { | - |
1276 | TransformationType t = inline_type(); | - |
1277 | if (t <= TxTranslate) evaluated: t <= TxTranslate yes Evaluation Count:141721 | yes Evaluation Count:9764 |
| 9764-141721 |
1278 | return rect.translated(affine._dx, affine._dy); executed: return rect.translated(affine._dx, affine._dy); Execution Count:141721 | 141721 |
1279 | | - |
1280 | if (t <= TxScale) { evaluated: t <= TxScale yes Evaluation Count:2701 | yes Evaluation Count:7063 |
| 2701-7063 |
1281 | qreal x = affine._m11*rect.x() + affine._dx; | - |
1282 | qreal y = affine._m22*rect.y() + affine._dy; | - |
1283 | qreal w = affine._m11*rect.width(); | - |
1284 | qreal h = affine._m22*rect.height(); | - |
1285 | if (w < 0) { evaluated: w < 0 yes Evaluation Count:198 | yes Evaluation Count:2503 |
| 198-2503 |
1286 | w = -w; | - |
1287 | x -= w; | - |
1288 | } executed: } Execution Count:198 | 198 |
1289 | if (h < 0) { evaluated: h < 0 yes Evaluation Count:198 | yes Evaluation Count:2503 |
| 198-2503 |
1290 | h = -h; | - |
1291 | y -= h; | - |
1292 | } executed: } Execution Count:198 | 198 |
1293 | return QRectF(x, y, w, h); executed: return QRectF(x, y, w, h); Execution Count:2701 | 2701 |
1294 | } else if (t < TxProject || !needsPerspectiveClipping(rect, *this)) { evaluated: t < TxProject yes Evaluation Count:7035 | yes Evaluation Count:28 |
evaluated: !needsPerspectiveClipping(rect, *this) yes Evaluation Count:24 | yes Evaluation Count:4 |
| 4-7035 |
1295 | qreal x = 0, y = 0; | - |
1296 | do { qreal FX_ = rect.x(); qreal FY_ = rect.y(); switch(t) { case TxNone: x = FX_; y = FY_; break; case TxTranslate: x = FX_ + affine._dx; y = FY_ + affine._dy; break; case TxScale: x = affine._m11 * FX_ + affine._dx; y = affine._m22 * FY_ + affine._dy; break; case TxRotate: case TxShear: case TxProject: x = affine._m11 * FX_ + affine._m21 * FY_ + affine._dx; y = affine._m12 * FX_ + affine._m22 * FY_ + affine._dy; if (t == TxProject) { qreal w = (m_13 * FX_ + m_23 * FY_ + m_33); if (w < qreal((sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001))) w = qreal((sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001)); w = 1./w; x *= w; y *= w; } } } while (0); never executed: w = qreal((sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001)); executed: } Execution Count:24 executed: } Execution Count:7059 executed: } Execution Count:7059 evaluated: t == TxProject yes Evaluation Count:24 | yes Evaluation Count:7035 |
partially evaluated: w < qreal((sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001)) no Evaluation Count:0 | yes Evaluation Count:24 |
partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:7059 |
| 0-7059 |
1297 | qreal xmin = x; | - |
1298 | qreal ymin = y; | - |
1299 | qreal xmax = x; | - |
1300 | qreal ymax = y; | - |
1301 | do { qreal FX_ = rect.x() + rect.width(); qreal FY_ = rect.y(); switch(t) { case TxNone: x = FX_; y = FY_; break; case TxTranslate: x = FX_ + affine._dx; y = FY_ + affine._dy; break; case TxScale: x = affine._m11 * FX_ + affine._dx; y = affine._m22 * FY_ + affine._dy; break; case TxRotate: case TxShear: case TxProject: x = affine._m11 * FX_ + affine._m21 * FY_ + affine._dx; y = affine._m12 * FX_ + affine._m22 * FY_ + affine._dy; if (t == TxProject) { qreal w = (m_13 * FX_ + m_23 * FY_ + m_33); if (w < qreal((sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001))) w = qreal((sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001)); w = 1./w; x *= w; y *= w; } } } while (0); never executed: w = qreal((sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001)); executed: } Execution Count:24 executed: } Execution Count:7059 executed: } Execution Count:7059 evaluated: t == TxProject yes Evaluation Count:24 | yes Evaluation Count:7035 |
partially evaluated: w < qreal((sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001)) no Evaluation Count:0 | yes Evaluation Count:24 |
partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:7059 |
| 0-7059 |
1302 | xmin = qMin(xmin, x); | - |
1303 | ymin = qMin(ymin, y); | - |
1304 | xmax = qMax(xmax, x); | - |
1305 | ymax = qMax(ymax, y); | - |
1306 | do { qreal FX_ = rect.x() + rect.width(); qreal FY_ = rect.y() + rect.height(); switch(t) { case TxNone: x = FX_; y = FY_; break; case TxTranslate: x = FX_ + affine._dx; y = FY_ + affine._dy; break; case TxScale: x = affine._m11 * FX_ + affine._dx; y = affine._m22 * FY_ + affine._dy; break; case TxRotate: case TxShear: case TxProject: x = affine._m11 * FX_ + affine._m21 * FY_ + affine._dx; y = affine._m12 * FX_ + affine._m22 * FY_ + affine._dy; if (t == TxProject) { qreal w = (m_13 * FX_ + m_23 * FY_ + m_33); if (w < qreal((sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001))) w = qreal((sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001)); w = 1./w; x *= w; y *= w; } } } while (0); never executed: w = qreal((sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001)); executed: } Execution Count:24 executed: } Execution Count:7059 executed: } Execution Count:7059 evaluated: t == TxProject yes Evaluation Count:24 | yes Evaluation Count:7035 |
partially evaluated: w < qreal((sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001)) no Evaluation Count:0 | yes Evaluation Count:24 |
partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:7059 |
| 0-7059 |
1307 | xmin = qMin(xmin, x); | - |
1308 | ymin = qMin(ymin, y); | - |
1309 | xmax = qMax(xmax, x); | - |
1310 | ymax = qMax(ymax, y); | - |
1311 | do { qreal FX_ = rect.x(); qreal FY_ = rect.y() + rect.height(); switch(t) { case TxNone: x = FX_; y = FY_; break; case TxTranslate: x = FX_ + affine._dx; y = FY_ + affine._dy; break; case TxScale: x = affine._m11 * FX_ + affine._dx; y = affine._m22 * FY_ + affine._dy; break; case TxRotate: case TxShear: case TxProject: x = affine._m11 * FX_ + affine._m21 * FY_ + affine._dx; y = affine._m12 * FX_ + affine._m22 * FY_ + affine._dy; if (t == TxProject) { qreal w = (m_13 * FX_ + m_23 * FY_ + m_33); if (w < qreal((sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001))) w = qreal((sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001)); w = 1./w; x *= w; y *= w; } } } while (0); never executed: w = qreal((sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001)); executed: } Execution Count:24 executed: } Execution Count:7059 executed: } Execution Count:7059 evaluated: t == TxProject yes Evaluation Count:24 | yes Evaluation Count:7035 |
partially evaluated: w < qreal((sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001)) no Evaluation Count:0 | yes Evaluation Count:24 |
partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:7059 |
| 0-7059 |
1312 | xmin = qMin(xmin, x); | - |
1313 | ymin = qMin(ymin, y); | - |
1314 | xmax = qMax(xmax, x); | - |
1315 | ymax = qMax(ymax, y); | - |
1316 | return QRectF(xmin, ymin, xmax-xmin, ymax - ymin); executed: return QRectF(xmin, ymin, xmax-xmin, ymax - ymin); Execution Count:7059 | 7059 |
1317 | } else { | - |
1318 | QPainterPath path; | - |
1319 | path.addRect(rect); | - |
1320 | return map(path).boundingRect(); executed: return map(path).boundingRect(); Execution Count:4 | 4 |
1321 | } | - |
1322 | } | - |
1323 | void QTransform::map(qreal x, qreal y, qreal *tx, qreal *ty) const | - |
1324 | { | - |
1325 | TransformationType t = inline_type(); | - |
1326 | do { qreal FX_ = x; qreal FY_ = y; switch(t) { case TxNone: *tx = FX_; *ty = FY_; break; case TxTranslate: *tx = FX_ + affine._dx; *ty = FY_ + affine._dy; break; case TxScale: *tx = affine._m11 * FX_ + affine._dx; *ty = affine._m22 * FY_ + affine._dy; break; case TxRotate: case TxShear: case TxProject: *tx = affine._m11 * FX_ + affine._m21 * FY_ + affine._dx; *ty = affine._m12 * FX_ + affine._m22 * FY_ + affine._dy; if (t == TxProject) { qreal w = (m_13 * FX_ + m_23 * FY_ + m_33); if (w < qreal((sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001))) w = qreal((sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001)); w = 1./w; *tx *= w; *ty *= w; } } } while (0); never executed: w = qreal((sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001)); executed: } Execution Count:4 executed: } Execution Count:4 partially evaluated: t == TxProject no Evaluation Count:0 | yes Evaluation Count:4 |
never evaluated: w < qreal((sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001)) partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
1327 | } executed: } Execution Count:4 | 4 |
1328 | void QTransform::map(int x, int y, int *tx, int *ty) const | - |
1329 | { | - |
1330 | TransformationType t = inline_type(); | - |
1331 | qreal fx = 0, fy = 0; | - |
1332 | do { qreal FX_ = x; qreal FY_ = y; switch(t) { case TxNone: fx = FX_; fy = FY_; break; case TxTranslate: fx = FX_ + affine._dx; fy = FY_ + affine._dy; break; case TxScale: fx = affine._m11 * FX_ + affine._dx; fy = affine._m22 * FY_ + affine._dy; break; case TxRotate: case TxShear: case TxProject: fx = affine._m11 * FX_ + affine._m21 * FY_ + affine._dx; fy = affine._m12 * FX_ + affine._m22 * FY_ + affine._dy; if (t == TxProject) { qreal w = (m_13 * FX_ + m_23 * FY_ + m_33); if (w < qreal((sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001))) w = qreal((sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001)); w = 1./w; fx *= w; fy *= w; } } } while (0); executed: break; Execution Count:1 never executed: w = qreal((sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001)); executed: } Execution Count:1 never evaluated: t == TxProject never evaluated: w < qreal((sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001)) partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
1333 | *tx = qRound(fx); | - |
1334 | *ty = qRound(fy); | - |
1335 | } executed: } Execution Count:1 | 1 |
1336 | | - |
1337 | | - |
1338 | | - |
1339 | | - |
1340 | | - |
1341 | | - |
1342 | | - |
1343 | const QMatrix &QTransform::toAffine() const | - |
1344 | { | - |
1345 | return affine; executed: return affine; Execution Count:434 | 434 |
1346 | } | - |
1347 | QTransform::TransformationType QTransform::type() const | - |
1348 | { | - |
1349 | if(m_dirty == TxNone || m_dirty < m_type) evaluated: m_dirty == TxNone yes Evaluation Count:1092573 | yes Evaluation Count:114177 |
evaluated: m_dirty < m_type yes Evaluation Count:10423 | yes Evaluation Count:103754 |
| 10423-1092573 |
1350 | return static_cast<TransformationType>(m_type); executed: return static_cast<TransformationType>(m_type); Execution Count:1102999 | 1102999 |
1351 | | - |
1352 | switch (static_cast<TransformationType>(m_dirty)) { | - |
1353 | case TxProject: | - |
1354 | if (!qFuzzyIsNull(m_13) || !qFuzzyIsNull(m_23) || !qFuzzyIsNull(m_33 - 1)) { evaluated: !qFuzzyIsNull(m_13) yes Evaluation Count:19 | yes Evaluation Count:6180 |
evaluated: !qFuzzyIsNull(m_23) yes Evaluation Count:20 | yes Evaluation Count:6160 |
evaluated: !qFuzzyIsNull(m_33 - 1) yes Evaluation Count:2 | yes Evaluation Count:6158 |
| 2-6180 |
1355 | m_type = TxProject; | - |
1356 | break; executed: break; Execution Count:41 | 41 |
1357 | } | - |
1358 | case TxShear: code before this statement executed: case TxShear: Execution Count:6158 | 6158 |
1359 | case TxRotate: | - |
1360 | if (!qFuzzyIsNull(affine._m12) || !qFuzzyIsNull(affine._m21)) { evaluated: !qFuzzyIsNull(affine._m12) yes Evaluation Count:8634 | yes Evaluation Count:6534 |
evaluated: !qFuzzyIsNull(affine._m21) yes Evaluation Count:1 | yes Evaluation Count:6533 |
| 1-8634 |
1361 | const qreal dot = affine._m11 * affine._m12 + affine._m21 * affine._m22; | - |
1362 | if (qFuzzyIsNull(dot)) evaluated: qFuzzyIsNull(dot) yes Evaluation Count:7669 | yes Evaluation Count:966 |
| 966-7669 |
1363 | m_type = TxRotate; executed: m_type = TxRotate; Execution Count:7669 | 7669 |
1364 | else | - |
1365 | m_type = TxShear; executed: m_type = TxShear; Execution Count:966 | 966 |
1366 | break; executed: break; Execution Count:8635 | 8635 |
1367 | } | - |
1368 | case TxScale: code before this statement executed: case TxScale: Execution Count:6533 | 6533 |
1369 | if (!qFuzzyIsNull(affine._m11 - 1) || !qFuzzyIsNull(affine._m22 - 1)) { evaluated: !qFuzzyIsNull(affine._m11 - 1) yes Evaluation Count:1254 | yes Evaluation Count:6372 |
evaluated: !qFuzzyIsNull(affine._m22 - 1) yes Evaluation Count:15 | yes Evaluation Count:6357 |
| 15-6372 |
1370 | m_type = TxScale; | - |
1371 | break; executed: break; Execution Count:1269 | 1269 |
1372 | } | - |
1373 | case TxTranslate: code before this statement executed: case TxTranslate: Execution Count:6357 | 6357 |
1374 | if (!qFuzzyIsNull(affine._dx) || !qFuzzyIsNull(affine._dy)) { evaluated: !qFuzzyIsNull(affine._dx) yes Evaluation Count:54042 | yes Evaluation Count:39767 |
evaluated: !qFuzzyIsNull(affine._dy) yes Evaluation Count:33379 | yes Evaluation Count:6388 |
| 6388-54042 |
1375 | m_type = TxTranslate; | - |
1376 | break; executed: break; Execution Count:87421 | 87421 |
1377 | } | - |
1378 | case TxNone: code before this statement executed: case TxNone: Execution Count:6388 | 6388 |
1379 | m_type = TxNone; | - |
1380 | break; executed: break; Execution Count:6388 | 6388 |
1381 | } | - |
1382 | | - |
1383 | m_dirty = TxNone; | - |
1384 | return static_cast<TransformationType>(m_type); executed: return static_cast<TransformationType>(m_type); Execution Count:103754 | 103754 |
1385 | } | - |
1386 | | - |
1387 | | - |
1388 | | - |
1389 | | - |
1390 | | - |
1391 | QTransform::operator QVariant() const | - |
1392 | { | - |
1393 | return QVariant(QVariant::Transform, this); executed: return QVariant(QVariant::Transform, this); Execution Count:1 | 1 |
1394 | } | - |
1395 | __attribute__((visibility("default"))) | - |
1396 | bool qt_scaleForTransform(const QTransform &transform, qreal *scale) | - |
1397 | { | - |
1398 | const QTransform::TransformationType type = transform.type(); | - |
1399 | if (type <= QTransform::TxTranslate) { evaluated: type <= QTransform::TxTranslate yes Evaluation Count:213214 | yes Evaluation Count:6469 |
| 6469-213214 |
1400 | if (scale) partially evaluated: scale yes Evaluation Count:213214 | no Evaluation Count:0 |
| 0-213214 |
1401 | *scale = 1; executed: *scale = 1; Execution Count:213214 | 213214 |
1402 | return true; executed: return true; Execution Count:213214 | 213214 |
1403 | } else if (type == QTransform::TxScale) { evaluated: type == QTransform::TxScale yes Evaluation Count:191 | yes Evaluation Count:6278 |
| 191-6278 |
1404 | const qreal xScale = qAbs(transform.m11()); | - |
1405 | const qreal yScale = qAbs(transform.m22()); | - |
1406 | if (scale) partially evaluated: scale yes Evaluation Count:191 | no Evaluation Count:0 |
| 0-191 |
1407 | *scale = qMax(xScale, yScale); executed: *scale = qMax(xScale, yScale); Execution Count:191 | 191 |
1408 | return qFuzzyCompare(xScale, yScale); executed: return qFuzzyCompare(xScale, yScale); Execution Count:191 | 191 |
1409 | } | - |
1410 | | - |
1411 | const qreal xScale = transform.m11() * transform.m11() | - |
1412 | + transform.m21() * transform.m21(); | - |
1413 | const qreal yScale = transform.m12() * transform.m12() | - |
1414 | + transform.m22() * transform.m22(); | - |
1415 | if (scale) partially evaluated: scale yes Evaluation Count:6278 | no Evaluation Count:0 |
| 0-6278 |
1416 | *scale = qSqrt(qMax(xScale, yScale)); executed: *scale = qSqrt(qMax(xScale, yScale)); Execution Count:6278 | 6278 |
1417 | return type == QTransform::TxRotate && qFuzzyCompare(xScale, yScale); executed: return type == QTransform::TxRotate && qFuzzyCompare(xScale, yScale); Execution Count:6278 | 6278 |
1418 | } | - |
1419 | | - |
1420 | | - |
1421 | | - |
| | |