tools/qrect.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3 -
4 -
5QRect QRect::normalized() const -
6{ -
7 QRect r; -
8 if (x2 < x1 - 1) {
evaluated: x2 < x1 - 1
TRUEFALSE
yes
Evaluation Count:880
yes
Evaluation Count:36337
880-36337
9 r.x1 = x2; -
10 r.x2 = x1; -
11 } else {
executed: }
Execution Count:880
880
12 r.x1 = x1; -
13 r.x2 = x2; -
14 }
executed: }
Execution Count:36337
36337
15 if (y2 < y1 - 1) {
evaluated: y2 < y1 - 1
TRUEFALSE
yes
Evaluation Count:407
yes
Evaluation Count:36810
407-36810
16 r.y1 = y2; -
17 r.y2 = y1; -
18 } else {
executed: }
Execution Count:407
407
19 r.y1 = y1; -
20 r.y2 = y2; -
21 }
executed: }
Execution Count:36810
36810
22 return r;
executed: return r;
Execution Count:37217
37217
23} -
24bool QRect::contains(const QPoint &p, bool proper) const -
25{ -
26 int l, r; -
27 if (x2 < x1 - 1) {
evaluated: x2 < x1 - 1
TRUEFALSE
yes
Evaluation Count:24
yes
Evaluation Count:4936662
24-4936662
28 l = x2; -
29 r = x1; -
30 } else {
executed: }
Execution Count:24
24
31 l = x1; -
32 r = x2; -
33 }
executed: }
Execution Count:4936662
4936662
34 if (proper) {
evaluated: proper
TRUEFALSE
yes
Evaluation Count:27
yes
Evaluation Count:4936659
27-4936659
35 if (p.x() <= l || p.x() >= r)
evaluated: p.x() <= l
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:20
evaluated: p.x() >= r
TRUEFALSE
yes
Evaluation Count:11
yes
Evaluation Count:9
7-20
36 return false;
executed: return false;
Execution Count:18
18
37 } else {
executed: }
Execution Count:9
9
38 if (p.x() < l || p.x() > r)
evaluated: p.x() < l
TRUEFALSE
yes
Evaluation Count:181877
yes
Evaluation Count:4754782
evaluated: p.x() > r
TRUEFALSE
yes
Evaluation Count:1316123
yes
Evaluation Count:3438659
181877-4754782
39 return false;
executed: return false;
Execution Count:1498000
1498000
40 }
executed: }
Execution Count:3438659
3438659
41 int t, b; -
42 if (y2 < y1 - 1) {
evaluated: y2 < y1 - 1
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:3438654
14-3438654
43 t = y2; -
44 b = y1; -
45 } else {
executed: }
Execution Count:14
14
46 t = y1; -
47 b = y2; -
48 }
executed: }
Execution Count:3438654
3438654
49 if (proper) {
evaluated: proper
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:3438659
9-3438659
50 if (p.y() <= t || p.y() >= b)
evaluated: p.y() <= t
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:6
partially evaluated: p.y() >= b
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6
0-6
51 return false;
executed: return false;
Execution Count:3
3
52 } else {
executed: }
Execution Count:6
6
53 if (p.y() < t || p.y() > b)
evaluated: p.y() < t
TRUEFALSE
yes
Evaluation Count:256170
yes
Evaluation Count:3182489
evaluated: p.y() > b
TRUEFALSE
yes
Evaluation Count:2915712
yes
Evaluation Count:266777
256170-3182489
54 return false;
executed: return false;
Execution Count:3171882
3171882
55 }
executed: }
Execution Count:266777
266777
56 return true;
executed: return true;
Execution Count:266783
266783
57} -
58bool QRect::contains(const QRect &r, bool proper) const -
59{ -
60 if (isNull() || r.isNull())
evaluated: isNull()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:8005
evaluated: r.isNull()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:8002
2-8005
61 return false;
executed: return false;
Execution Count:5
5
62 -
63 int l1 = x1; -
64 int r1 = x1; -
65 if (x2 - x1 + 1 < 0)
evaluated: x2 - x1 + 1 < 0
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:7998
4-7998
66 l1 = x2;
executed: l1 = x2;
Execution Count:4
4
67 else -
68 r1 = x2;
executed: r1 = x2;
Execution Count:7998
7998
69 -
70 int l2 = r.x1; -
71 int r2 = r.x1; -
72 if (r.x2 - r.x1 + 1 < 0)
evaluated: r.x2 - r.x1 + 1 < 0
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:7998
4-7998
73 l2 = r.x2;
executed: l2 = r.x2;
Execution Count:4
4
74 else -
75 r2 = r.x2;
executed: r2 = r.x2;
Execution Count:7998
7998
76 -
77 if (proper) {
partially evaluated: proper
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8002
0-8002
78 if (l2 <= l1 || r2 >= r1)
never evaluated: l2 <= l1
never evaluated: r2 >= r1
0
79 return false;
never executed: return false;
0
80 } else {
never executed: }
0
81 if (l2 < l1 || r2 > r1)
evaluated: l2 < l1
TRUEFALSE
yes
Evaluation Count:141
yes
Evaluation Count:7861
evaluated: r2 > r1
TRUEFALSE
yes
Evaluation Count:1917
yes
Evaluation Count:5944
141-7861
82 return false;
executed: return false;
Execution Count:2058
2058
83 }
executed: }
Execution Count:5944
5944
84 -
85 int t1 = y1; -
86 int b1 = y1; -
87 if (y2 - y1 + 1 < 0)
evaluated: y2 - y1 + 1 < 0
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:5942
2-5942
88 t1 = y2;
executed: t1 = y2;
Execution Count:2
2
89 else -
90 b1 = y2;
executed: b1 = y2;
Execution Count:5942
5942
91 -
92 int t2 = r.y1; -
93 int b2 = r.y1; -
94 if (r.y2 - r.y1 + 1 < 0)
evaluated: r.y2 - r.y1 + 1 < 0
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:5942
2-5942
95 t2 = r.y2;
executed: t2 = r.y2;
Execution Count:2
2
96 else -
97 b2 = r.y2;
executed: b2 = r.y2;
Execution Count:5942
5942
98 -
99 if (proper) {
partially evaluated: proper
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5944
0-5944
100 if (t2 <= t1 || b2 >= b1)
never evaluated: t2 <= t1
never evaluated: b2 >= b1
0
101 return false;
never executed: return false;
0
102 } else {
never executed: }
0
103 if (t2 < t1 || b2 > b1)
evaluated: t2 < t1
TRUEFALSE
yes
Evaluation Count:92
yes
Evaluation Count:5852
evaluated: b2 > b1
TRUEFALSE
yes
Evaluation Count:1282
yes
Evaluation Count:4570
92-5852
104 return false;
executed: return false;
Execution Count:1374
1374
105 }
executed: }
Execution Count:4570
4570
106 -
107 return true;
executed: return true;
Execution Count:4570
4570
108} -
109QRect QRect::operator|(const QRect &r) const -
110{ -
111 if (isNull())
evaluated: isNull()
TRUEFALSE
yes
Evaluation Count:1170
yes
Evaluation Count:313122
1170-313122
112 return r;
executed: return r;
Execution Count:1170
1170
113 if (r.isNull())
evaluated: r.isNull()
TRUEFALSE
yes
Evaluation Count:155022
yes
Evaluation Count:158100
155022-158100
114 return *this;
executed: return *this;
Execution Count:155022
155022
115 -
116 int l1 = x1; -
117 int r1 = x1; -
118 if (x2 - x1 + 1 < 0)
evaluated: x2 - x1 + 1 < 0
TRUEFALSE
yes
Evaluation Count:46
yes
Evaluation Count:158054
46-158054
119 l1 = x2;
executed: l1 = x2;
Execution Count:46
46
120 else -
121 r1 = x2;
executed: r1 = x2;
Execution Count:158054
158054
122 -
123 int l2 = r.x1; -
124 int r2 = r.x1; -
125 if (r.x2 - r.x1 + 1 < 0)
evaluated: r.x2 - r.x1 + 1 < 0
TRUEFALSE
yes
Evaluation Count:136
yes
Evaluation Count:157964
136-157964
126 l2 = r.x2;
executed: l2 = r.x2;
Execution Count:136
136
127 else -
128 r2 = r.x2;
executed: r2 = r.x2;
Execution Count:157964
157964
129 -
130 int t1 = y1; -
131 int b1 = y1; -
132 if (y2 - y1 + 1 < 0)
evaluated: y2 - y1 + 1 < 0
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:158096
4-158096
133 t1 = y2;
executed: t1 = y2;
Execution Count:4
4
134 else -
135 b1 = y2;
executed: b1 = y2;
Execution Count:158096
158096
136 -
137 int t2 = r.y1; -
138 int b2 = r.y1; -
139 if (r.y2 - r.y1 + 1 < 0)
evaluated: r.y2 - r.y1 + 1 < 0
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:158096
4-158096
140 t2 = r.y2;
executed: t2 = r.y2;
Execution Count:4
4
141 else -
142 b2 = r.y2;
executed: b2 = r.y2;
Execution Count:158096
158096
143 -
144 QRect tmp; -
145 tmp.x1 = qMin(l1, l2); -
146 tmp.x2 = qMax(r1, r2); -
147 tmp.y1 = qMin(t1, t2); -
148 tmp.y2 = qMax(b1, b2); -
149 return tmp;
executed: return tmp;
Execution Count:158100
158100
150} -
151QRect QRect::operator&(const QRect &r) const -
152{ -
153 if (isNull() || r.isNull())
evaluated: isNull()
TRUEFALSE
yes
Evaluation Count:241
yes
Evaluation Count:280991
evaluated: r.isNull()
TRUEFALSE
yes
Evaluation Count:250
yes
Evaluation Count:280741
241-280991
154 return QRect();
executed: return QRect();
Execution Count:491
491
155 -
156 int l1 = x1; -
157 int r1 = x1; -
158 if (x2 - x1 + 1 < 0)
evaluated: x2 - x1 + 1 < 0
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:280731
10-280731
159 l1 = x2;
executed: l1 = x2;
Execution Count:10
10
160 else -
161 r1 = x2;
executed: r1 = x2;
Execution Count:280731
280731
162 -
163 int l2 = r.x1; -
164 int r2 = r.x1; -
165 if (r.x2 - r.x1 + 1 < 0)
evaluated: r.x2 - r.x1 + 1 < 0
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:280737
4-280737
166 l2 = r.x2;
executed: l2 = r.x2;
Execution Count:4
4
167 else -
168 r2 = r.x2;
executed: r2 = r.x2;
Execution Count:280737
280737
169 -
170 if (l1 > r2 || l2 > r1)
evaluated: l1 > r2
TRUEFALSE
yes
Evaluation Count:7097
yes
Evaluation Count:273644
evaluated: l2 > r1
TRUEFALSE
yes
Evaluation Count:3274
yes
Evaluation Count:270370
3274-273644
171 return QRect();
executed: return QRect();
Execution Count:10371
10371
172 -
173 int t1 = y1; -
174 int b1 = y1; -
175 if (y2 - y1 + 1 < 0)
evaluated: y2 - y1 + 1 < 0
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:270366
4-270366
176 t1 = y2;
executed: t1 = y2;
Execution Count:4
4
177 else -
178 b1 = y2;
executed: b1 = y2;
Execution Count:270366
270366
179 -
180 int t2 = r.y1; -
181 int b2 = r.y1; -
182 if (r.y2 - r.y1 + 1 < 0)
evaluated: r.y2 - r.y1 + 1 < 0
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:270367
3-270367
183 t2 = r.y2;
executed: t2 = r.y2;
Execution Count:3
3
184 else -
185 b2 = r.y2;
executed: b2 = r.y2;
Execution Count:270367
270367
186 -
187 if (t1 > b2 || t2 > b1)
evaluated: t1 > b2
TRUEFALSE
yes
Evaluation Count:1826
yes
Evaluation Count:268544
evaluated: t2 > b1
TRUEFALSE
yes
Evaluation Count:652
yes
Evaluation Count:267892
652-268544
188 return QRect();
executed: return QRect();
Execution Count:2478
2478
189 -
190 QRect tmp; -
191 tmp.x1 = qMax(l1, l2); -
192 tmp.x2 = qMin(r1, r2); -
193 tmp.y1 = qMax(t1, t2); -
194 tmp.y2 = qMin(b1, b2); -
195 return tmp;
executed: return tmp;
Execution Count:267892
267892
196} -
197bool QRect::intersects(const QRect &r) const -
198{ -
199 if (isNull() || r.isNull())
evaluated: isNull()
TRUEFALSE
yes
Evaluation Count:571
yes
Evaluation Count:31163
evaluated: r.isNull()
TRUEFALSE
yes
Evaluation Count:538
yes
Evaluation Count:30625
538-31163
200 return false;
executed: return false;
Execution Count:1109
1109
201 -
202 int l1 = x1; -
203 int r1 = x1; -
204 if (x2 - x1 + 1 < 0)
evaluated: x2 - x1 + 1 < 0
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:30621
4-30621
205 l1 = x2;
executed: l1 = x2;
Execution Count:4
4
206 else -
207 r1 = x2;
executed: r1 = x2;
Execution Count:30621
30621
208 -
209 int l2 = r.x1; -
210 int r2 = r.x1; -
211 if (r.x2 - r.x1 + 1 < 0)
evaluated: r.x2 - r.x1 + 1 < 0
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:30616
9-30616
212 l2 = r.x2;
executed: l2 = r.x2;
Execution Count:9
9
213 else -
214 r2 = r.x2;
executed: r2 = r.x2;
Execution Count:30616
30616
215 -
216 if (l1 > r2 || l2 > r1)
evaluated: l1 > r2
TRUEFALSE
yes
Evaluation Count:2407
yes
Evaluation Count:28218
evaluated: l2 > r1
TRUEFALSE
yes
Evaluation Count:429
yes
Evaluation Count:27789
429-28218
217 return false;
executed: return false;
Execution Count:2836
2836
218 -
219 int t1 = y1; -
220 int b1 = y1; -
221 if (y2 - y1 + 1 < 0)
evaluated: y2 - y1 + 1 < 0
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:27786
3-27786
222 t1 = y2;
executed: t1 = y2;
Execution Count:3
3
223 else -
224 b1 = y2;
executed: b1 = y2;
Execution Count:27786
27786
225 -
226 int t2 = r.y1; -
227 int b2 = r.y1; -
228 if (r.y2 - r.y1 + 1 < 0)
evaluated: r.y2 - r.y1 + 1 < 0
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:27781
8-27781
229 t2 = r.y2;
executed: t2 = r.y2;
Execution Count:8
8
230 else -
231 b2 = r.y2;
executed: b2 = r.y2;
Execution Count:27781
27781
232 -
233 if (t1 > b2 || t2 > b1)
evaluated: t1 > b2
TRUEFALSE
yes
Evaluation Count:258
yes
Evaluation Count:27531
evaluated: t2 > b1
TRUEFALSE
yes
Evaluation Count:175
yes
Evaluation Count:27356
175-27531
234 return false;
executed: return false;
Execution Count:433
433
235 -
236 return true;
executed: return true;
Execution Count:27356
27356
237} -
238QDataStream &operator<<(QDataStream &s, const QRect &r) -
239{ -
240 if (s.version() == 1)
partially evaluated: s.version() == 1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:112
0-112
241 s << (qint16)r.left() << (qint16)r.top() 0
242 << (qint16)r.right() << (qint16)r.bottom();
never executed: s << (qint16)r.left() << (qint16)r.top() << (qint16)r.right() << (qint16)r.bottom();
0
243 else -
244 s << (qint32)r.left() << (qint32)r.top() 112
245 << (qint32)r.right() << (qint32)r.bottom();
executed: s << (qint32)r.left() << (qint32)r.top() << (qint32)r.right() << (qint32)r.bottom();
Execution Count:112
112
246 return s;
executed: return s;
Execution Count:112
112
247} -
248QDataStream &operator>>(QDataStream &s, QRect &r) -
249{ -
250 if (s.version() == 1) {
partially evaluated: s.version() == 1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:122
0-122
251 qint16 x1, y1, x2, y2; -
252 s >> x1; s >> y1; s >> x2; s >> y2; -
253 r.setCoords(x1, y1, x2, y2); -
254 }
never executed: }
0
255 else { -
256 qint32 x1, y1, x2, y2; -
257 s >> x1; s >> y1; s >> x2; s >> y2; -
258 r.setCoords(x1, y1, x2, y2); -
259 }
executed: }
Execution Count:122
122
260 return s;
executed: return s;
Execution Count:122
122
261} -
262 -
263 -
264 -
265 -
266 -
267QDebug operator<<(QDebug dbg, const QRect &r) { -
268 dbg.nospace() << "QRect(" << r.x() << ',' << r.y() << ' ' -
269 << r.width() << 'x' << r.height() << ')'; -
270 return dbg.space();
executed: return dbg.space();
Execution Count:4
4
271} -
272QRectF QRectF::normalized() const -
273{ -
274 QRectF r = *this; -
275 if (r.w < 0) {
evaluated: r.w < 0
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:5189
1-5189
276 r.xp += r.w; -
277 r.w = -r.w; -
278 }
executed: }
Execution Count:1
1
279 if (r.h < 0) {
partially evaluated: r.h < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5190
0-5190
280 r.yp += r.h; -
281 r.h = -r.h; -
282 }
never executed: }
0
283 return r;
executed: return r;
Execution Count:5190
5190
284} -
285bool QRectF::contains(const QPointF &p) const -
286{ -
287 qreal l = xp; -
288 qreal r = xp; -
289 if (w < 0)
evaluated: w < 0
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:3404
12-3404
290 l += w;
executed: l += w;
Execution Count:12
12
291 else -
292 r += w;
executed: r += w;
Execution Count:3404
3404
293 if (l == r)
evaluated: l == r
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:3412
4-3412
294 return false;
executed: return false;
Execution Count:4
4
295 -
296 if (p.x() < l || p.x() > r)
evaluated: p.x() < l
TRUEFALSE
yes
Evaluation Count:358
yes
Evaluation Count:3054
evaluated: p.x() > r
TRUEFALSE
yes
Evaluation Count:388
yes
Evaluation Count:2666
358-3054
297 return false;
executed: return false;
Execution Count:746
746
298 -
299 qreal t = yp; -
300 qreal b = yp; -
301 if (h < 0)
evaluated: h < 0
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:2654
12-2654
302 t += h;
executed: t += h;
Execution Count:12
12
303 else -
304 b += h;
executed: b += h;
Execution Count:2654
2654
305 if (t == b)
evaluated: t == b
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:2665
1-2665
306 return false;
executed: return false;
Execution Count:1
1
307 -
308 if (p.y() < t || p.y() > b)
evaluated: p.y() < t
TRUEFALSE
yes
Evaluation Count:193
yes
Evaluation Count:2472
evaluated: p.y() > b
TRUEFALSE
yes
Evaluation Count:180
yes
Evaluation Count:2292
180-2472
309 return false;
executed: return false;
Execution Count:373
373
310 -
311 return true;
executed: return true;
Execution Count:2292
2292
312} -
313bool QRectF::contains(const QRectF &r) const -
314{ -
315 qreal l1 = xp; -
316 qreal r1 = xp; -
317 if (w < 0)
evaluated: w < 0
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:4430
4-4430
318 l1 += w;
executed: l1 += w;
Execution Count:4
4
319 else -
320 r1 += w;
executed: r1 += w;
Execution Count:4430
4430
321 if (l1 == r1)
evaluated: l1 == r1
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:4424
10-4424
322 return false;
executed: return false;
Execution Count:10
10
323 -
324 qreal l2 = r.xp; -
325 qreal r2 = r.xp; -
326 if (r.w < 0)
evaluated: r.w < 0
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:4420
4-4420
327 l2 += r.w;
executed: l2 += r.w;
Execution Count:4
4
328 else -
329 r2 += r.w;
executed: r2 += r.w;
Execution Count:4420
4420
330 if (l2 == r2)
evaluated: l2 == r2
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:4423
1-4423
331 return false;
executed: return false;
Execution Count:1
1
332 -
333 if (l2 < l1 || r2 > r1)
evaluated: l2 < l1
TRUEFALSE
yes
Evaluation Count:134
yes
Evaluation Count:4289
evaluated: r2 > r1
TRUEFALSE
yes
Evaluation Count:138
yes
Evaluation Count:4151
134-4289
334 return false;
executed: return false;
Execution Count:272
272
335 -
336 qreal t1 = yp; -
337 qreal b1 = yp; -
338 if (h < 0)
evaluated: h < 0
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:4148
3-4148
339 t1 += h;
executed: t1 += h;
Execution Count:3
3
340 else -
341 b1 += h;
executed: b1 += h;
Execution Count:4148
4148
342 if (t1 == b1)
partially evaluated: t1 == b1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4151
0-4151
343 return false;
never executed: return false;
0
344 -
345 qreal t2 = r.yp; -
346 qreal b2 = r.yp; -
347 if (r.h < 0)
evaluated: r.h < 0
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:4149
2-4149
348 t2 += r.h;
executed: t2 += r.h;
Execution Count:2
2
349 else -
350 b2 += r.h;
executed: b2 += r.h;
Execution Count:4149
4149
351 if (t2 == b2)
partially evaluated: t2 == b2
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4151
0-4151
352 return false;
never executed: return false;
0
353 -
354 if (t2 < t1 || b2 > b1)
evaluated: t2 < t1
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:4146
evaluated: b2 > b1
TRUEFALSE
yes
Evaluation Count:42
yes
Evaluation Count:4104
5-4146
355 return false;
executed: return false;
Execution Count:47
47
356 -
357 return true;
executed: return true;
Execution Count:4104
4104
358} -
359QRectF QRectF::operator|(const QRectF &r) const -
360{ -
361 if (isNull())
evaluated: isNull()
TRUEFALSE
yes
Evaluation Count:2260
yes
Evaluation Count:2408
2260-2408
362 return r;
executed: return r;
Execution Count:2260
2260
363 if (r.isNull())
evaluated: r.isNull()
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:2399
9-2399
364 return *this;
executed: return *this;
Execution Count:9
9
365 -
366 qreal left = xp; -
367 qreal right = xp; -
368 if (w < 0)
evaluated: w < 0
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:2395
4-2395
369 left += w;
executed: left += w;
Execution Count:4
4
370 else -
371 right += w;
executed: right += w;
Execution Count:2395
2395
372 -
373 if (r.w < 0) {
evaluated: r.w < 0
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:2395
4-2395
374 left = qMin(left, r.xp + r.w); -
375 right = qMax(right, r.xp); -
376 } else {
executed: }
Execution Count:4
4
377 left = qMin(left, r.xp); -
378 right = qMax(right, r.xp + r.w); -
379 }
executed: }
Execution Count:2395
2395
380 -
381 qreal top = yp; -
382 qreal bottom = yp; -
383 if (h < 0)
evaluated: h < 0
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:2395
4-2395
384 top += h;
executed: top += h;
Execution Count:4
4
385 else -
386 bottom += h;
executed: bottom += h;
Execution Count:2395
2395
387 -
388 if (r.h < 0) {
evaluated: r.h < 0
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:2395
4-2395
389 top = qMin(top, r.yp + r.h); -
390 bottom = qMax(bottom, r.yp); -
391 } else {
executed: }
Execution Count:4
4
392 top = qMin(top, r.yp); -
393 bottom = qMax(bottom, r.yp + r.h); -
394 }
executed: }
Execution Count:2395
2395
395 -
396 return QRectF(left, top, right - left, bottom - top);
executed: return QRectF(left, top, right - left, bottom - top);
Execution Count:2399
2399
397} -
398QRectF QRectF::operator&(const QRectF &r) const -
399{ -
400 qreal l1 = xp; -
401 qreal r1 = xp; -
402 if (w < 0)
evaluated: w < 0
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:3014
8-3014
403 l1 += w;
executed: l1 += w;
Execution Count:8
8
404 else -
405 r1 += w;
executed: r1 += w;
Execution Count:3014
3014
406 if (l1 == r1)
evaluated: l1 == r1
TRUEFALSE
yes
Evaluation Count:19
yes
Evaluation Count:3003
19-3003
407 return QRectF();
executed: return QRectF();
Execution Count:19
19
408 -
409 qreal l2 = r.xp; -
410 qreal r2 = r.xp; -
411 if (r.w < 0)
evaluated: r.w < 0
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:2999
4-2999
412 l2 += r.w;
executed: l2 += r.w;
Execution Count:4
4
413 else -
414 r2 += r.w;
executed: r2 += r.w;
Execution Count:2999
2999
415 if (l2 == r2)
evaluated: l2 == r2
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:3000
3-3000
416 return QRectF();
executed: return QRectF();
Execution Count:3
3
417 -
418 if (l1 >= r2 || l2 >= r1)
evaluated: l1 >= r2
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:2999
evaluated: l2 >= r1
TRUEFALSE
yes
Evaluation Count:18
yes
Evaluation Count:2981
1-2999
419 return QRectF();
executed: return QRectF();
Execution Count:19
19
420 -
421 qreal t1 = yp; -
422 qreal b1 = yp; -
423 if (h < 0)
evaluated: h < 0
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:2978
3-2978
424 t1 += h;
executed: t1 += h;
Execution Count:3
3
425 else -
426 b1 += h;
executed: b1 += h;
Execution Count:2978
2978
427 if (t1 == b1)
partially evaluated: t1 == b1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2981
0-2981
428 return QRectF();
never executed: return QRectF();
0
429 -
430 qreal t2 = r.yp; -
431 qreal b2 = r.yp; -
432 if (r.h < 0)
evaluated: r.h < 0
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:2978
3-2978
433 t2 += r.h;
executed: t2 += r.h;
Execution Count:3
3
434 else -
435 b2 += r.h;
executed: b2 += r.h;
Execution Count:2978
2978
436 if (t2 == b2)
partially evaluated: t2 == b2
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2981
0-2981
437 return QRectF();
never executed: return QRectF();
0
438 -
439 if (t1 >= b2 || t2 >= b1)
evaluated: t1 >= b2
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:2979
evaluated: t2 >= b1
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:2977
2-2979
440 return QRectF();
executed: return QRectF();
Execution Count:4
4
441 -
442 QRectF tmp; -
443 tmp.xp = qMax(l1, l2); -
444 tmp.yp = qMax(t1, t2); -
445 tmp.w = qMin(r1, r2) - tmp.xp; -
446 tmp.h = qMin(b1, b2) - tmp.yp; -
447 return tmp;
executed: return tmp;
Execution Count:2977
2977
448} -
449bool QRectF::intersects(const QRectF &r) const -
450{ -
451 qreal l1 = xp; -
452 qreal r1 = xp; -
453 if (w < 0)
evaluated: w < 0
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:1574
4-1574
454 l1 += w;
executed: l1 += w;
Execution Count:4
4
455 else -
456 r1 += w;
executed: r1 += w;
Execution Count:1574
1574
457 if (l1 == r1)
evaluated: l1 == r1
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1576
2-1576
458 return false;
executed: return false;
Execution Count:2
2
459 -
460 qreal l2 = r.xp; -
461 qreal r2 = r.xp; -
462 if (r.w < 0)
evaluated: r.w < 0
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:1572
4-1572
463 l2 += r.w;
executed: l2 += r.w;
Execution Count:4
4
464 else -
465 r2 += r.w;
executed: r2 += r.w;
Execution Count:1572
1572
466 if (l2 == r2)
evaluated: l2 == r2
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1575
1-1575
467 return false;
executed: return false;
Execution Count:1
1
468 -
469 if (l1 >= r2 || l2 >= r1)
evaluated: l1 >= r2
TRUEFALSE
yes
Evaluation Count:47
yes
Evaluation Count:1528
evaluated: l2 >= r1
TRUEFALSE
yes
Evaluation Count:61
yes
Evaluation Count:1467
47-1528
470 return false;
executed: return false;
Execution Count:108
108
471 -
472 qreal t1 = yp; -
473 qreal b1 = yp; -
474 if (h < 0)
evaluated: h < 0
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:1464
3-1464
475 t1 += h;
executed: t1 += h;
Execution Count:3
3
476 else -
477 b1 += h;
executed: b1 += h;
Execution Count:1464
1464
478 if (t1 == b1)
partially evaluated: t1 == b1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1467
0-1467
479 return false;
never executed: return false;
0
480 -
481 qreal t2 = r.yp; -
482 qreal b2 = r.yp; -
483 if (r.h < 0)
evaluated: r.h < 0
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:1464
3-1464
484 t2 += r.h;
executed: t2 += r.h;
Execution Count:3
3
485 else -
486 b2 += r.h;
executed: b2 += r.h;
Execution Count:1464
1464
487 if (t2 == b2)
partially evaluated: t2 == b2
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1467
0-1467
488 return false;
never executed: return false;
0
489 -
490 if (t1 >= b2 || t2 >= b1)
evaluated: t1 >= b2
TRUEFALSE
yes
Evaluation Count:24
yes
Evaluation Count:1443
evaluated: t2 >= b1
TRUEFALSE
yes
Evaluation Count:78
yes
Evaluation Count:1365
24-1443
491 return false;
executed: return false;
Execution Count:102
102
492 -
493 return true;
executed: return true;
Execution Count:1365
1365
494} -
495QRect QRectF::toAlignedRect() const -
496{ -
497 int xmin = int(qFloor(xp)); -
498 int xmax = int(qCeil(xp + w)); -
499 int ymin = int(qFloor(yp)); -
500 int ymax = int(qCeil(yp + h)); -
501 return QRect(xmin, ymin, xmax - xmin, ymax - ymin);
executed: return QRect(xmin, ymin, xmax - xmin, ymax - ymin);
Execution Count:43026
43026
502} -
503QDataStream &operator<<(QDataStream &s, const QRectF &r) -
504{ -
505 s << double(r.x()) << double(r.y()) << double(r.width()) << double(r.height()); -
506 return s;
executed: return s;
Execution Count:72
72
507} -
508QDataStream &operator>>(QDataStream &s, QRectF &r) -
509{ -
510 double x, y, w, h; -
511 s >> x; -
512 s >> y; -
513 s >> w; -
514 s >> h; -
515 r.setRect(qreal(x), qreal(y), qreal(w), qreal(h)); -
516 return s;
executed: return s;
Execution Count:75
75
517} -
518 -
519 -
520 -
521 -
522 -
523QDebug operator<<(QDebug dbg, const QRectF &r) { -
524 dbg.nospace() << "QRectF(" << r.x() << ',' << r.y() << ' ' -
525 << r.width() << 'x' << r.height() << ')'; -
526 return dbg.space();
executed: return dbg.space();
Execution Count:1
1
527} -
528 -
529 -
530 -
531 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial