painting/qregion.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3 -
4QRegion::QRegion(int x, int y, int w, int h, RegionType t) -
5{ -
6 QRegion tmp(QRect(x, y, w, h), t); -
7 tmp.d->ref.ref(); -
8 d = tmp.d; -
9}
executed: }
Execution Count:14706
14706
10void QRegion::detach() -
11{ -
12 if (d->ref.load() != 1)
evaluated: d->ref.load() != 1
TRUEFALSE
yes
Evaluation Count:64594
yes
Evaluation Count:42399
42399-64594
13 *this = copy();
executed: *this = copy();
Execution Count:64594
64594
14}
executed: }
Execution Count:106993
106993
15void QRegion::exec(const QByteArray &buffer, int ver, QDataStream::ByteOrder byteOrder) -
16{ -
17 QByteArray copy = buffer; -
18 QDataStream s(&copy, QIODevice::ReadOnly); -
19 if (ver)
partially evaluated: ver
TRUEFALSE
yes
Evaluation Count:74
no
Evaluation Count:0
0-74
20 s.setVersion(ver);
executed: s.setVersion(ver);
Execution Count:74
74
21 s.setByteOrder(byteOrder); -
22 QRegion rgn; -
23 -
24 -
25 -
26 while (!s.atEnd()) {
evaluated: !s.atEnd()
TRUEFALSE
yes
Evaluation Count:31
yes
Evaluation Count:74
31-74
27 qint32 id; -
28 if (s.version() == 1) {
partially evaluated: s.version() == 1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:31
0-31
29 int id_int; -
30 s >> id_int; -
31 id = id_int; -
32 } else {
never executed: }
0
33 s >> id; -
34 }
executed: }
Execution Count:31
31
35 -
36 -
37 -
38 -
39 -
40 if (id == 1 || id == 2) {
partially evaluated: id == 1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:31
partially evaluated: id == 2
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:31
0-31
41 QRect r; -
42 s >> r; -
43 rgn = QRegion(r, id == 1 ? Rectangle : Ellipse); -
44 } else if (id == 3 || id == 4) {
never executed: }
partially evaluated: id == 3
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:31
partially evaluated: id == 4
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:31
0-31
45 QPolygon a; -
46 s >> a; -
47 rgn = QRegion(a, id == 4 ? Qt::WindingFill : Qt::OddEvenFill); -
48 } else if (id == 5) {
partially evaluated: id == 5
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:31
never executed: }
0-31
49 QPoint p; -
50 s >> p; -
51 rgn.translate(p.x(), p.y()); -
52 } else if (id >= 6 && id <= 9) {
partially evaluated: id >= 6
TRUEFALSE
yes
Evaluation Count:31
no
Evaluation Count:0
partially evaluated: id <= 9
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:31
never executed: }
0-31
53 QByteArray bop1, bop2; -
54 QRegion r1, r2; -
55 s >> bop1; -
56 r1.exec(bop1); -
57 s >> bop2; -
58 r2.exec(bop2); -
59 -
60 switch (id) { -
61 case 6: -
62 rgn = r1.united(r2); -
63 break;
never executed: break;
0
64 case 7: -
65 rgn = r1.intersected(r2); -
66 break;
never executed: break;
0
67 case 8: -
68 rgn = r1.subtracted(r2); -
69 break;
never executed: break;
0
70 case 9: -
71 rgn = r1.xored(r2); -
72 break;
never executed: break;
0
73 } -
74 } else if (id == 10) {
never executed: }
partially evaluated: id == 10
TRUEFALSE
yes
Evaluation Count:31
no
Evaluation Count:0
0-31
75 -
76 quint32 n; -
77 s >> n; -
78 QRect r; -
79 for (int i=0; i<(int)n; i++) {
evaluated: i<(int)n
TRUEFALSE
yes
Evaluation Count:31
yes
Evaluation Count:31
31
80 s >> r; -
81 rgn = rgn.united(QRegion(r)); -
82 }
executed: }
Execution Count:31
31
83 }
executed: }
Execution Count:31
31
84 } -
85 *this = rgn; -
86}
executed: }
Execution Count:74
74
87QDataStream &operator<<(QDataStream &s, const QRegion &r) -
88{ -
89 QVector<QRect> a = r.rects(); -
90 if (a.isEmpty()) {
evaluated: a.isEmpty()
TRUEFALSE
yes
Evaluation Count:43
yes
Evaluation Count:31
31-43
91 s << (quint32)0; -
92 } else {
executed: }
Execution Count:43
43
93 if (s.version() == 1) {
partially evaluated: s.version() == 1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:31
0-31
94 int i; -
95 for (i = a.size() - 1; i > 0; --i) {
never evaluated: i > 0
0
96 s << (quint32)(12 + i * 24); -
97 s << (int)6; -
98 }
never executed: }
0
99 for (i = 0; i < a.size(); ++i) {
never evaluated: i < a.size()
0
100 s << (quint32)(4+8) << (int)1 << a[i]; -
101 }
never executed: }
0
102 } else {
never executed: }
0
103 s << (quint32)(4 + 4 + 16 * a.size()); -
104 s << (qint32)10; -
105 s << a; -
106 }
executed: }
Execution Count:31
31
107 } -
108 return s;
executed: return s;
Execution Count:74
74
109} -
110QDataStream &operator>>(QDataStream &s, QRegion &r) -
111{ -
112 QByteArray b; -
113 s >> b; -
114 r.exec(b, s.version(), s.byteOrder()); -
115 return s;
executed: return s;
Execution Count:74
74
116} -
117 -
118 -
119 -
120QDebug operator<<(QDebug s, const QRegion &r) -
121{ -
122 QVector<QRect> rects = r.rects(); -
123 s.nospace() << "QRegion(size=" << rects.size() << "), " -
124 << "bounds = " << r.boundingRect() << '\n'; -
125 for (int i=0; i<rects.size(); ++i)
partially evaluated: i<rects.size()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
126 s << "- " << i << rects.at(i) << '\n';
never executed: s << "- " << i << rects.at(i) << '\n';
0
127 return s;
executed: return s;
Execution Count:1
1
128} -
129const QRegion QRegion::operator|(const QRegion &r) const -
130 { return united(r); }
executed: return united(r);
Execution Count:19683
19683
131 -
132 -
133 -
134 -
135 -
136 -
137 -
138const QRegion QRegion::operator+(const QRegion &r) const -
139 { return united(r); }
executed: return united(r);
Execution Count:56
56
140 -
141 -
142 -
143 -
144 -
145const QRegion QRegion::operator+(const QRect &r) const -
146 { return united(r); }
executed: return united(r);
Execution Count:34
34
147 -
148 -
149 -
150 -
151 -
152 -
153 -
154const QRegion QRegion::operator&(const QRegion &r) const -
155 { return intersected(r); }
executed: return intersected(r);
Execution Count:417
417
156 -
157 -
158 -
159 -
160 -
161const QRegion QRegion::operator&(const QRect &r) const -
162{ -
163 return intersected(r);
executed: return intersected(r);
Execution Count:94128
94128
164} -
165 -
166 -
167 -
168 -
169 -
170 -
171 -
172const QRegion QRegion::operator-(const QRegion &r) const -
173 { return subtracted(r); }
executed: return subtracted(r);
Execution Count:22593
22593
174 -
175 -
176 -
177 -
178 -
179 -
180 -
181const QRegion QRegion::operator^(const QRegion &r) const -
182 { return xored(r); }
executed: return xored(r);
Execution Count:21
21
183QRegion& QRegion::operator|=(const QRegion &r) -
184 { return *this = *this | r; }
executed: return *this = *this | r;
Execution Count:3059
3059
185QRegion& QRegion::operator&=(const QRegion &r) -
186 { return *this = *this & r; }
executed: return *this = *this & r;
Execution Count:103
103
187 -
188 -
189 -
190 -
191 -
192 -
193QRegion& QRegion::operator&=(const QRect &r) -
194{ -
195 return *this = *this & r;
executed: return *this = *this & r;
Execution Count:50457
50457
196} -
197QRegion& QRegion::operator-=(const QRegion &r) -
198 { return *this = *this - r; }
executed: return *this = *this - r;
Execution Count:18760
18760
199QRegion& QRegion::operator^=(const QRegion &r) -
200 { return *this = *this ^ r; }
executed: return *this = *this ^ r;
Execution Count:11
11
201QRegion::operator QVariant() const -
202{ -
203 return QVariant(QVariant::Region, this);
executed: return QVariant(QVariant::Region, this);
Execution Count:1
1
204} -
205QRegion -
206QRegion::translated(int dx, int dy) const -
207{ -
208 QRegion ret(*this); -
209 ret.translate(dx, dy); -
210 return ret;
executed: return ret;
Execution Count:38831
38831
211} -
212 -
213 -
214inline bool rect_intersects(const QRect &r1, const QRect &r2) -
215{ -
216 return (r1.right() >= r2.left() && r1.left() <= r2.right() && 38201
217 r1.bottom() >= r2.top() && r1.top() <= r2.bottom());
executed: return (r1.right() >= r2.left() && r1.left() <= r2.right() && r1.bottom() >= r2.top() && r1.top() <= r2.bottom());
Execution Count:38201
38201
218} -
219 -
220 -
221 -
222 -
223 -
224 -
225 -
226bool QRegion::intersects(const QRegion &region) const -
227{ -
228 if (isEmpty() || region.isEmpty())
evaluated: isEmpty()
TRUEFALSE
yes
Evaluation Count:3241
yes
Evaluation Count:4839
partially evaluated: region.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4839
0-4839
229 return false;
executed: return false;
Execution Count:3241
3241
230 -
231 if (!rect_intersects(boundingRect(), region.boundingRect()))
evaluated: !rect_intersects(boundingRect(), region.boundingRect())
TRUEFALSE
yes
Evaluation Count:55
yes
Evaluation Count:4784
55-4784
232 return false;
executed: return false;
Execution Count:55
55
233 if (rectCount() == 1 && region.rectCount() == 1)
evaluated: rectCount() == 1
TRUEFALSE
yes
Evaluation Count:3258
yes
Evaluation Count:1526
evaluated: region.rectCount() == 1
TRUEFALSE
yes
Evaluation Count:2614
yes
Evaluation Count:644
644-3258
234 return true;
executed: return true;
Execution Count:2614
2614
235 -
236 const QVector<QRect> myRects = rects(); -
237 const QVector<QRect> otherRects = region.rects(); -
238 -
239 for (QVector<QRect>::const_iterator i1 = myRects.constBegin(); i1 < myRects.constEnd(); ++i1)
evaluated: i1 < myRects.constEnd()
TRUEFALSE
yes
Evaluation Count:3190
yes
Evaluation Count:182
182-3190
240 for (QVector<QRect>::const_iterator i2 = otherRects.constBegin(); i2 < otherRects.constEnd(); ++i2)
evaluated: i2 < otherRects.constEnd()
TRUEFALSE
yes
Evaluation Count:13000
yes
Evaluation Count:1202
1202-13000
241 if (rect_intersects(*i1, *i2))
evaluated: rect_intersects(*i1, *i2)
TRUEFALSE
yes
Evaluation Count:1988
yes
Evaluation Count:11012
1988-11012
242 return true;
executed: return true;
Execution Count:1988
1988
243 return false;
executed: return false;
Execution Count:182
182
244} -
245namespace { -
246 -
247struct Segment -
248{ -
249 Segment() {} -
250 Segment(const QPoint &p) -
251 : added(false) -
252 , point(p) -
253 { -
254 }
never executed: }
0
255 -
256 int left() const -
257 { -
258 return qMin(point.x(), next->point.x());
never executed: return qMin(point.x(), next->point.x());
0
259 } -
260 -
261 int right() const -
262 { -
263 return qMax(point.x(), next->point.x());
never executed: return qMax(point.x(), next->point.x());
0
264 } -
265 -
266 bool overlaps(const Segment &other) const -
267 { -
268 return left() < other.right() && other.left() < right();
never executed: return left() < other.right() && other.left() < right();
0
269 } -
270 -
271 void connect(Segment &other) -
272 { -
273 next = &other; -
274 other.prev = this; -
275 -
276 horizontal = (point.y() == other.point.y()); -
277 }
never executed: }
0
278 -
279 void merge(Segment &other) -
280 { -
281 if (right() <= other.right()) {
never evaluated: right() <= other.right()
0
282 QPoint p = other.point; -
283 Segment *oprev = other.prev; -
284 -
285 other.point = point; -
286 other.prev = prev; -
287 prev->next = &other; -
288 -
289 point = p; -
290 prev = oprev; -
291 oprev->next = this; -
292 } else {
never executed: }
0
293 Segment *onext = other.next; -
294 other.next = next; -
295 next->prev = &other; -
296 -
297 next = onext; -
298 next->prev = this; -
299 }
never executed: }
0
300 } -
301 -
302 int horizontal : 1; -
303 int added : 1; -
304 -
305 QPoint point; -
306 Segment *prev; -
307 Segment *next; -
308}; -
309 -
310void mergeSegments(Segment *a, int na, Segment *b, int nb) -
311{ -
312 int i = 0; -
313 int j = 0; -
314 -
315 while (i != na && j != nb) {
never evaluated: i != na
never evaluated: j != nb
0
316 Segment &sa = a[i]; -
317 Segment &sb = b[j]; -
318 const int ra = sa.right(); -
319 const int rb = sb.right(); -
320 if (sa.overlaps(sb))
never evaluated: sa.overlaps(sb)
0
321 sa.merge(sb);
never executed: sa.merge(sb);
0
322 i += (rb >= ra); -
323 j += (ra >= rb); -
324 }
never executed: }
0
325}
never executed: }
0
326 -
327void addSegmentsToPath(Segment *segment, QPainterPath &path) -
328{ -
329 Segment *current = segment; -
330 path.moveTo(current->point); -
331 -
332 current->added = true; -
333 -
334 Segment *last = current; -
335 current = current->next; -
336 while (current != segment) {
never evaluated: current != segment
0
337 if (current->horizontal != last->horizontal)
never evaluated: current->horizontal != last->horizontal
0
338 path.lineTo(current->point);
never executed: path.lineTo(current->point);
0
339 current->added = true; -
340 last = current; -
341 current = current->next; -
342 }
never executed: }
0
343}
never executed: }
0
344 -
345} -
346 -
347__attribute__((visibility("default"))) QPainterPath qt_regionToPath(const QRegion &region) -
348{ -
349 QPainterPath result; -
350 if (region.rectCount() == 1) {
partially evaluated: region.rectCount() == 1
TRUEFALSE
yes
Evaluation Count:7
no
Evaluation Count:0
0-7
351 result.addRect(region.boundingRect()); -
352 return result;
executed: return result;
Execution Count:7
7
353 } -
354 -
355 const QVector<QRect> rects = region.rects(); -
356 -
357 QVarLengthArray<Segment> segments; -
358 segments.resize(4 * rects.size()); -
359 -
360 const QRect *rect = rects.constData(); -
361 const QRect *end = rect + rects.size(); -
362 -
363 int lastRowSegmentCount = 0; -
364 Segment *lastRowSegments = 0; -
365 -
366 int lastSegment = 0; -
367 int lastY = 0; -
368 while (rect != end) {
never evaluated: rect != end
0
369 const int y = rect[0].y(); -
370 int count = 0; -
371 while (&rect[count] != end && rect[count].y() == y)
never evaluated: &rect[count] != end
never evaluated: rect[count].y() == y
0
372 ++count;
never executed: ++count;
0
373 -
374 for (int i = 0; i < count; ++i) {
never evaluated: i < count
0
375 int offset = lastSegment + i; -
376 segments[offset] = Segment(rect[i].topLeft()); -
377 segments[offset += count] = Segment(rect[i].topRight() + QPoint(1, 0)); -
378 segments[offset += count] = Segment(rect[i].bottomRight() + QPoint(1, 1)); -
379 segments[offset += count] = Segment(rect[i].bottomLeft() + QPoint(0, 1)); -
380 -
381 offset = lastSegment + i; -
382 for (int j = 0; j < 4; ++j)
never evaluated: j < 4
0
383 segments[offset + j * count].connect(segments[offset + ((j + 1) % 4) * count]);
never executed: segments[offset + j * count].connect(segments[offset + ((j + 1) % 4) * count]);
0
384 }
never executed: }
0
385 -
386 if (lastRowSegments && lastY == y)
never evaluated: lastRowSegments
never evaluated: lastY == y
0
387 mergeSegments(lastRowSegments, lastRowSegmentCount, &segments[lastSegment], count);
never executed: mergeSegments(lastRowSegments, lastRowSegmentCount, &segments[lastSegment], count);
0
388 -
389 lastRowSegments = &segments[lastSegment + 2 * count]; -
390 lastRowSegmentCount = count; -
391 lastSegment += 4 * count; -
392 lastY = y + rect[0].height(); -
393 rect += count; -
394 }
never executed: }
0
395 -
396 for (int i = 0; i < lastSegment; ++i) {
never evaluated: i < lastSegment
0
397 Segment *segment = &segments[i]; -
398 if (!segment->added)
never evaluated: !segment->added
0
399 addSegmentsToPath(segment, result);
never executed: addSegmentsToPath(segment, result);
0
400 }
never executed: }
0
401 -
402 return result;
never executed: return result;
0
403} -
404struct QRegionPrivate { -
405 int numRects; -
406 QVector<QRect> rects; -
407 QRect extents; -
408 QRect innerRect; -
409 int innerArea; -
410 -
411 inline QRegionPrivate() : numRects(0), innerArea(-1) {}
executed: }
Execution Count:270
270
412 inline QRegionPrivate(const QRect &r) { -
413 numRects = 1; -
414 extents = r; -
415 innerRect = r; -
416 innerArea = r.width() * r.height(); -
417 }
executed: }
Execution Count:145820
145820
418 -
419 inline QRegionPrivate(const QRegionPrivate &r) { -
420 rects = r.rects; -
421 numRects = r.numRects; -
422 extents = r.extents; -
423 innerRect = r.innerRect; -
424 innerArea = r.innerArea; -
425 }
executed: }
Execution Count:64594
64594
426 -
427 inline QRegionPrivate &operator=(const QRegionPrivate &r) { -
428 rects = r.rects; -
429 numRects = r.numRects; -
430 extents = r.extents; -
431 innerRect = r.innerRect; -
432 innerArea = r.innerArea; -
433 return *this;
executed: return *this;
Execution Count:24
24
434 } -
435 -
436 void intersect(const QRect &r); -
437 -
438 -
439 -
440 -
441 -
442 inline bool contains(const QRegionPrivate &r) const { -
443 return contains(r.extents);
executed: return contains(r.extents);
Execution Count:85126
85126
444 } -
445 -
446 inline bool contains(const QRect &r2) const { -
447 const QRect &r1 = innerRect; -
448 return r2.left() >= r1.left() && r2.right() <= r1.right() 124294
449 && r2.top() >= r1.top() && r2.bottom() <= r1.bottom();
executed: return r2.left() >= r1.left() && r2.right() <= r1.right() && r2.top() >= r1.top() && r2.bottom() <= r1.bottom();
Execution Count:124294
124294
450 } -
451 -
452 -
453 -
454 -
455 inline bool within(const QRect &r1) const { -
456 const QRect &r2 = extents; -
457 return r2.left() >= r1.left() && r2.right() <= r1.right() 98601
458 && r2.top() >= r1.top() && r2.bottom() <= r1.bottom();
executed: return r2.left() >= r1.left() && r2.right() <= r1.right() && r2.top() >= r1.top() && r2.bottom() <= r1.bottom();
Execution Count:98601
98601
459 } -
460 -
461 inline void updateInnerRect(const QRect &rect) { -
462 const int area = rect.width() * rect.height(); -
463 if (area > innerArea) {
evaluated: area > innerArea
TRUEFALSE
yes
Evaluation Count:40552
yes
Evaluation Count:101805
40552-101805
464 innerArea = area; -
465 innerRect = rect; -
466 }
executed: }
Execution Count:40552
40552
467 }
executed: }
Execution Count:142357
142357
468 -
469 inline void vectorize() { -
470 if (numRects == 1) {
evaluated: numRects == 1
TRUEFALSE
yes
Evaluation Count:57667
yes
Evaluation Count:49630
49630-57667
471 if (!rects.size())
evaluated: !rects.size()
TRUEFALSE
yes
Evaluation Count:43040
yes
Evaluation Count:14627
14627-43040
472 rects.resize(1);
executed: rects.resize(1);
Execution Count:43040
43040
473 rects[0] = extents; -
474 }
executed: }
Execution Count:57667
57667
475 }
executed: }
Execution Count:107297
107297
476 -
477 inline void append(const QRect *r); -
478 void append(const QRegionPrivate *r); -
479 void prepend(const QRect *r); -
480 void prepend(const QRegionPrivate *r); -
481 inline bool canAppend(const QRect *r) const; -
482 inline bool canAppend(const QRegionPrivate *r) const; -
483 inline bool canPrepend(const QRect *r) const; -
484 inline bool canPrepend(const QRegionPrivate *r) const; -
485 -
486 inline bool mergeFromRight(QRect *left, const QRect *right); -
487 inline bool mergeFromLeft(QRect *left, const QRect *right); -
488 inline bool mergeFromBelow(QRect *top, const QRect *bottom, -
489 const QRect *nextToTop, -
490 const QRect *nextToBottom); -
491 inline bool mergeFromAbove(QRect *bottom, const QRect *top, -
492 const QRect *nextToBottom, -
493 const QRect *nextToTop); -
494 -
495 -
496 -
497 -
498}; -
499 -
500static inline bool isEmptyHelper(const QRegionPrivate *preg) -
501{ -
502 return !preg || preg->numRects == 0;
executed: return !preg || preg->numRects == 0;
Execution Count:696768
696768
503} -
504 -
505static inline bool canMergeFromRight(const QRect *left, const QRect *right) -
506{ -
507 return (right->top() == left->top() 16952
508 && right->bottom() == left->bottom() 16952
509 && right->left() <= (left->right() + 1));
executed: return (right->top() == left->top() && right->bottom() == left->bottom() && right->left() <= (left->right() + 1));
Execution Count:16952
16952
510} -
511 -
512static inline bool canMergeFromLeft(const QRect *right, const QRect *left) -
513{ -
514 return canMergeFromRight(left, right);
executed: return canMergeFromRight(left, right);
Execution Count:5071
5071
515} -
516 -
517bool QRegionPrivate::mergeFromRight(QRect *left, const QRect *right) -
518{ -
519 if (canMergeFromRight(left, right)) {
evaluated: canMergeFromRight(left, right)
TRUEFALSE
yes
Evaluation Count:1844
yes
Evaluation Count:10037
1844-10037
520 left->setRight(right->right()); -
521 updateInnerRect(*left); -
522 return true;
executed: return true;
Execution Count:1844
1844
523 } -
524 return false;
executed: return false;
Execution Count:10037
10037
525} -
526 -
527bool QRegionPrivate::mergeFromLeft(QRect *right, const QRect *left) -
528{ -
529 if (canMergeFromLeft(right, left)) {
evaluated: canMergeFromLeft(right, left)
TRUEFALSE
yes
Evaluation Count:1633
yes
Evaluation Count:3438
1633-3438
530 right->setLeft(left->left()); -
531 updateInnerRect(*right); -
532 return true;
executed: return true;
Execution Count:1633
1633
533 } -
534 return false;
executed: return false;
Execution Count:3438
3438
535} -
536 -
537static inline bool canMergeFromBelow(const QRect *top, const QRect *bottom, -
538 const QRect *nextToTop, -
539 const QRect *nextToBottom) -
540{ -
541 if (nextToTop && nextToTop->y() == top->y())
evaluated: nextToTop
TRUEFALSE
yes
Evaluation Count:6564
yes
Evaluation Count:11025
evaluated: nextToTop->y() == top->y()
TRUEFALSE
yes
Evaluation Count:2247
yes
Evaluation Count:4317
2247-11025
542 return false;
executed: return false;
Execution Count:2247
2247
543 if (nextToBottom && nextToBottom->y() == bottom->y())
evaluated: nextToBottom
TRUEFALSE
yes
Evaluation Count:447
yes
Evaluation Count:14895
evaluated: nextToBottom->y() == bottom->y()
TRUEFALSE
yes
Evaluation Count:59
yes
Evaluation Count:388
59-14895
544 return false;
executed: return false;
Execution Count:59
59
545 -
546 return ((top->bottom() >= (bottom->top() - 1)) 15283
547 && top->left() == bottom->left() 15283
548 && top->right() == bottom->right());
executed: return ((top->bottom() >= (bottom->top() - 1)) && top->left() == bottom->left() && top->right() == bottom->right());
Execution Count:15283
15283
549} -
550 -
551bool QRegionPrivate::mergeFromBelow(QRect *top, const QRect *bottom, -
552 const QRect *nextToTop, -
553 const QRect *nextToBottom) -
554{ -
555 if (canMergeFromBelow(top, bottom, nextToTop, nextToBottom)) {
evaluated: canMergeFromBelow(top, bottom, nextToTop, nextToBottom)
TRUEFALSE
yes
Evaluation Count:1608
yes
Evaluation Count:9301
1608-9301
556 top->setBottom(bottom->bottom()); -
557 updateInnerRect(*top); -
558 return true;
executed: return true;
Execution Count:1608
1608
559 } -
560 return false;
executed: return false;
Execution Count:9301
9301
561} -
562 -
563bool QRegionPrivate::mergeFromAbove(QRect *bottom, const QRect *top, -
564 const QRect *nextToBottom, -
565 const QRect *nextToTop) -
566{ -
567 if (canMergeFromBelow(top, bottom, nextToTop, nextToBottom)) {
evaluated: canMergeFromBelow(top, bottom, nextToTop, nextToBottom)
TRUEFALSE
yes
Evaluation Count:2201
yes
Evaluation Count:2428
2201-2428
568 bottom->setTop(top->top()); -
569 updateInnerRect(*bottom); -
570 return true;
executed: return true;
Execution Count:2201
2201
571 } -
572 return false;
executed: return false;
Execution Count:2428
2428
573} -
574 -
575static inline QRect qt_rect_intersect_normalized(const QRect &r1, -
576 const QRect &r2) -
577{ -
578 QRect r; -
579 r.setLeft(qMax(r1.left(), r2.left())); -
580 r.setRight(qMin(r1.right(), r2.right())); -
581 r.setTop(qMax(r1.top(), r2.top())); -
582 r.setBottom(qMin(r1.bottom(), r2.bottom())); -
583 return r;
executed: return r;
Execution Count:20026
20026
584} -
585 -
586void QRegionPrivate::intersect(const QRect &rect) -
587{ -
588 qt_noop(); -
589 qt_noop(); -
590 -
591 -
592 -
593 -
594 -
595 const QRect r = rect.normalized(); -
596 extents = QRect(); -
597 innerRect = QRect(); -
598 innerArea = -1; -
599 -
600 QRect *dest = rects.data(); -
601 const QRect *src = dest; -
602 int n = numRects; -
603 numRects = 0; -
604 while (n--) {
evaluated: n--
TRUEFALSE
yes
Evaluation Count:19373
yes
Evaluation Count:4145
4145-19373
605 *dest = qt_rect_intersect_normalized(*src++, r); -
606 if (dest->isEmpty())
evaluated: dest->isEmpty()
TRUEFALSE
yes
Evaluation Count:14988
yes
Evaluation Count:4385
4385-14988
607 continue;
executed: continue;
Execution Count:14988
14988
608 -
609 if (numRects == 0) {
evaluated: numRects == 0
TRUEFALSE
yes
Evaluation Count:2334
yes
Evaluation Count:2051
2051-2334
610 extents = *dest; -
611 } else {
executed: }
Execution Count:2334
2334
612 extents.setLeft(qMin(extents.left(), dest->left())); -
613 -
614 -
615 extents.setRight(qMax(extents.right(), dest->right())); -
616 extents.setBottom(qMax(extents.bottom(), dest->bottom())); -
617 -
618 const QRect *nextToLast = (numRects > 1 ? dest - 2 : 0);
evaluated: numRects > 1
TRUEFALSE
yes
Evaluation Count:1207
yes
Evaluation Count:844
844-1207
619 -
620 -
621 if (canMergeFromBelow(dest - 1, dest, nextToLast, 0)) {
evaluated: canMergeFromBelow(dest - 1, dest, nextToLast, 0)
TRUEFALSE
yes
Evaluation Count:255
yes
Evaluation Count:1796
255-1796
622 if (!n || src->y() != dest->y() || src->left() > r.right()) {
evaluated: !n
TRUEFALSE
yes
Evaluation Count:56
yes
Evaluation Count:199
evaluated: src->y() != dest->y()
TRUEFALSE
yes
Evaluation Count:159
yes
Evaluation Count:40
evaluated: src->left() > r.right()
TRUEFALSE
yes
Evaluation Count:33
yes
Evaluation Count:7
7-199
623 QRect *prev = dest - 1; -
624 prev->setBottom(dest->bottom()); -
625 updateInnerRect(*prev); -
626 continue;
executed: continue;
Execution Count:248
248
627 } -
628 }
executed: }
Execution Count:7
7
629 }
executed: }
Execution Count:1803
1803
630 updateInnerRect(*dest); -
631 ++dest; -
632 ++numRects; -
633 }
executed: }
Execution Count:4137
4137
634 -
635 -
636 -
637}
executed: }
Execution Count:4145
4145
638 -
639void QRegionPrivate::append(const QRect *r) -
640{ -
641 qt_noop(); -
642 -
643 QRect *myLast = (numRects == 1 ? &extents : rects.data() + (numRects - 1));
evaluated: numRects == 1
TRUEFALSE
yes
Evaluation Count:6553
yes
Evaluation Count:4946
4946-6553
644 if (mergeFromRight(myLast, r)) {
evaluated: mergeFromRight(myLast, r)
TRUEFALSE
yes
Evaluation Count:1505
yes
Evaluation Count:9994
1505-9994
645 if (numRects > 1) {
evaluated: numRects > 1
TRUEFALSE
yes
Evaluation Count:530
yes
Evaluation Count:975
530-975
646 const QRect *nextToTop = (numRects > 2 ? myLast - 2 : 0);
evaluated: numRects > 2
TRUEFALSE
yes
Evaluation Count:461
yes
Evaluation Count:69
69-461
647 if (mergeFromBelow(myLast - 1, myLast, nextToTop, 0))
evaluated: mergeFromBelow(myLast - 1, myLast, nextToTop, 0)
TRUEFALSE
yes
Evaluation Count:47
yes
Evaluation Count:483
47-483
648 --numRects;
executed: --numRects;
Execution Count:47
47
649 }
executed: }
Execution Count:530
530
650 } else if (mergeFromBelow(myLast, r, (numRects > 1 ? myLast - 1 : 0), 0)) {
executed: }
Execution Count:1505
evaluated: mergeFromBelow(myLast, r, (numRects > 1 ? myLast - 1 : 0), 0)
TRUEFALSE
yes
Evaluation Count:1211
yes
Evaluation Count:8783
1211-8783
651 -
652 } else {
executed: }
Execution Count:1211
1211
653 vectorize(); -
654 ++numRects; -
655 updateInnerRect(*r); -
656 if (rects.size() < numRects)
evaluated: rects.size() < numRects
TRUEFALSE
yes
Evaluation Count:8101
yes
Evaluation Count:682
682-8101
657 rects.resize(numRects);
executed: rects.resize(numRects);
Execution Count:8101
8101
658 rects[numRects - 1] = *r; -
659 }
executed: }
Execution Count:8783
8783
660 extents.setCoords(qMin(extents.left(), r->left()), -
661 qMin(extents.top(), r->top()), -
662 qMax(extents.right(), r->right()), -
663 qMax(extents.bottom(), r->bottom())); -
664 -
665 -
666 -
667 -
668}
executed: }
Execution Count:11499
11499
669 -
670void QRegionPrivate::append(const QRegionPrivate *r) -
671{ -
672 qt_noop(); -
673 -
674 if (r->numRects == 1) {
evaluated: r->numRects == 1
TRUEFALSE
yes
Evaluation Count:8960
yes
Evaluation Count:382
382-8960
675 append(&r->extents); -
676 return;
executed: return;
Execution Count:8960
8960
677 } -
678 -
679 vectorize(); -
680 -
681 QRect *destRect = rects.data() + numRects; -
682 const QRect *srcRect = r->rects.constData(); -
683 int numAppend = r->numRects; -
684 -
685 -
686 { -
687 const QRect *rFirst = srcRect; -
688 QRect *myLast = destRect - 1; -
689 const QRect *nextToLast = (numRects > 1 ? myLast - 1 : 0);
evaluated: numRects > 1
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:379
3-379
690 if (mergeFromRight(myLast, rFirst)) {
evaluated: mergeFromRight(myLast, rFirst)
TRUEFALSE
yes
Evaluation Count:339
yes
Evaluation Count:43
43-339
691 ++srcRect; -
692 --numAppend; -
693 const QRect *rNextToFirst = (numAppend > 1 ? rFirst + 2 : 0);
partially evaluated: numAppend > 1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:339
0-339
694 if (mergeFromBelow(myLast, rFirst + 1, nextToLast, rNextToFirst)) {
partially evaluated: mergeFromBelow(myLast, rFirst + 1, nextToLast, rNextToFirst)
TRUEFALSE
yes
Evaluation Count:339
no
Evaluation Count:0
0-339
695 ++srcRect; -
696 --numAppend; -
697 }
executed: }
Execution Count:339
339
698 if (numRects > 1) {
evaluated: numRects > 1
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:336
3-336
699 nextToLast = (numRects > 2 ? myLast - 2 : 0);
partially evaluated: numRects > 2
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
700 rNextToFirst = (numAppend > 0 ? srcRect : 0);
partially evaluated: numAppend > 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
701 if (mergeFromBelow(myLast - 1, myLast, nextToLast, rNextToFirst)) {
partially evaluated: mergeFromBelow(myLast - 1, myLast, nextToLast, rNextToFirst)
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
702 --destRect; -
703 --numRects; -
704 }
executed: }
Execution Count:3
3
705 }
executed: }
Execution Count:3
3
706 } else if (mergeFromBelow(myLast, rFirst, nextToLast, rFirst + 1)) {
executed: }
Execution Count:339
evaluated: mergeFromBelow(myLast, rFirst, nextToLast, rFirst + 1)
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:35
8-339
707 ++srcRect; -
708 --numAppend; -
709 }
executed: }
Execution Count:8
8
710 } -
711 -
712 -
713 if (numAppend > 0) {
evaluated: numAppend > 0
TRUEFALSE
yes
Evaluation Count:43
yes
Evaluation Count:339
43-339
714 const int newNumRects = numRects + numAppend; -
715 if (newNumRects > rects.size()) {
partially evaluated: newNumRects > rects.size()
TRUEFALSE
yes
Evaluation Count:43
no
Evaluation Count:0
0-43
716 rects.resize(newNumRects); -
717 destRect = rects.data() + numRects; -
718 }
executed: }
Execution Count:43
43
719 memcpy(destRect, srcRect, numAppend * sizeof(QRect)); -
720 -
721 numRects = newNumRects; -
722 }
executed: }
Execution Count:43
43
723 -
724 -
725 if (innerArea < r->innerArea) {
evaluated: innerArea < r->innerArea
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:374
8-374
726 innerArea = r->innerArea; -
727 innerRect = r->innerRect; -
728 }
executed: }
Execution Count:8
8
729 -
730 -
731 destRect = &extents; -
732 srcRect = &r->extents; -
733 extents.setCoords(qMin(destRect->left(), srcRect->left()), -
734 qMin(destRect->top(), srcRect->top()), -
735 qMax(destRect->right(), srcRect->right()), -
736 qMax(destRect->bottom(), srcRect->bottom())); -
737 -
738 -
739 -
740 -
741}
executed: }
Execution Count:382
382
742 -
743void QRegionPrivate::prepend(const QRegionPrivate *r) -
744{ -
745 qt_noop(); -
746 -
747 if (r->numRects == 1) {
evaluated: r->numRects == 1
TRUEFALSE
yes
Evaluation Count:3988
yes
Evaluation Count:495
495-3988
748 prepend(&r->extents); -
749 return;
executed: return;
Execution Count:3988
3988
750 } -
751 -
752 vectorize(); -
753 -
754 int numPrepend = r->numRects; -
755 int numSkip = 0; -
756 -
757 -
758 { -
759 QRect *myFirst = rects.data(); -
760 const QRect *nextToFirst = (numRects > 1 ? myFirst + 1 : 0);
evaluated: numRects > 1
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:490
5-490
761 const QRect *rLast = r->rects.constData() + r->numRects - 1; -
762 const QRect *rNextToLast = (r->numRects > 1 ? rLast - 1 : 0);
partially evaluated: r->numRects > 1
TRUEFALSE
yes
Evaluation Count:495
no
Evaluation Count:0
0-495
763 if (mergeFromLeft(myFirst, rLast)) {
evaluated: mergeFromLeft(myFirst, rLast)
TRUEFALSE
yes
Evaluation Count:18
yes
Evaluation Count:477
18-477
764 --numPrepend; -
765 --rLast; -
766 rNextToLast = (numPrepend > 1 ? rLast - 1 : 0);
partially evaluated: numPrepend > 1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:18
0-18
767 if (mergeFromAbove(myFirst, rLast, nextToFirst, rNextToLast)) {
partially evaluated: mergeFromAbove(myFirst, rLast, nextToFirst, rNextToLast)
TRUEFALSE
yes
Evaluation Count:18
no
Evaluation Count:0
0-18
768 --numPrepend; -
769 --rLast; -
770 }
executed: }
Execution Count:18
18
771 if (numRects > 1) {
evaluated: numRects > 1
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:15
3-15
772 nextToFirst = (numRects > 2? myFirst + 2 : 0);
partially evaluated: numRects > 2
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
773 rNextToLast = (numPrepend > 0 ? rLast : 0);
partially evaluated: numPrepend > 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
774 if (mergeFromAbove(myFirst + 1, myFirst, nextToFirst, rNextToLast)) {
partially evaluated: mergeFromAbove(myFirst + 1, myFirst, nextToFirst, rNextToLast)
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
775 --numRects; -
776 ++numSkip; -
777 }
executed: }
Execution Count:3
3
778 }
executed: }
Execution Count:3
3
779 } else if (mergeFromAbove(myFirst, rLast, nextToFirst, rNextToLast)) {
executed: }
Execution Count:18
evaluated: mergeFromAbove(myFirst, rLast, nextToFirst, rNextToLast)
TRUEFALSE
yes
Evaluation Count:263
yes
Evaluation Count:214
18-263
780 --numPrepend; -
781 }
executed: }
Execution Count:263
263
782 } -
783 -
784 if (numPrepend > 0) {
evaluated: numPrepend > 0
TRUEFALSE
yes
Evaluation Count:477
yes
Evaluation Count:18
18-477
785 const int newNumRects = numRects + numPrepend; -
786 if (newNumRects > rects.size())
evaluated: newNumRects > rects.size()
TRUEFALSE
yes
Evaluation Count:475
yes
Evaluation Count:2
2-475
787 rects.resize(newNumRects);
executed: rects.resize(newNumRects);
Execution Count:475
475
788 -
789 -
790 memmove(rects.data() + numPrepend, rects.constData() + numSkip, -
791 numRects * sizeof(QRect)); -
792 -
793 -
794 memcpy(rects.data(), r->rects.constData(), numPrepend * sizeof(QRect)); -
795 -
796 numRects = newNumRects; -
797 }
executed: }
Execution Count:477
477
798 -
799 -
800 if (innerArea < r->innerArea) {
evaluated: innerArea < r->innerArea
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:483
12-483
801 innerArea = r->innerArea; -
802 innerRect = r->innerRect; -
803 }
executed: }
Execution Count:12
12
804 -
805 -
806 extents.setCoords(qMin(extents.left(), r->extents.left()), -
807 qMin(extents.top(), r->extents.top()), -
808 qMax(extents.right(), r->extents.right()), -
809 qMax(extents.bottom(), r->extents.bottom())); -
810 -
811 -
812 -
813 -
814}
executed: }
Execution Count:495
495
815 -
816void QRegionPrivate::prepend(const QRect *r) -
817{ -
818 qt_noop(); -
819 -
820 QRect *myFirst = (numRects == 1 ? &extents : rects.data());
evaluated: numRects == 1
TRUEFALSE
yes
Evaluation Count:3041
yes
Evaluation Count:1535
1535-3041
821 if (mergeFromLeft(myFirst, r)) {
evaluated: mergeFromLeft(myFirst, r)
TRUEFALSE
yes
Evaluation Count:1615
yes
Evaluation Count:2961
1615-2961
822 if (numRects > 1) {
evaluated: numRects > 1
TRUEFALSE
yes
Evaluation Count:1170
yes
Evaluation Count:445
445-1170
823 const QRect *nextToFirst = (numRects > 2 ? myFirst + 2 : 0);
evaluated: numRects > 2
TRUEFALSE
yes
Evaluation Count:34
yes
Evaluation Count:1136
34-1136
824 if (mergeFromAbove(myFirst + 1, myFirst, nextToFirst, 0)) {
evaluated: mergeFromAbove(myFirst + 1, myFirst, nextToFirst, 0)
TRUEFALSE
yes
Evaluation Count:1100
yes
Evaluation Count:70
70-1100
825 --numRects; -
826 memmove(rects.data(), rects.constData() + 1, -
827 numRects * sizeof(QRect)); -
828 }
executed: }
Execution Count:1100
1100
829 }
executed: }
Execution Count:1170
1170
830 } else if (mergeFromAbove(myFirst, r, (numRects > 1 ? myFirst + 1 : 0), 0)) {
executed: }
Execution Count:1615
evaluated: mergeFromAbove(myFirst, r, (numRects > 1 ? myFirst + 1 : 0), 0)
TRUEFALSE
yes
Evaluation Count:817
yes
Evaluation Count:2144
817-2144
831 -
832 } else {
executed: }
Execution Count:817
817
833 vectorize(); -
834 ++numRects; -
835 updateInnerRect(*r); -
836 rects.prepend(*r); -
837 }
executed: }
Execution Count:2144
2144
838 extents.setCoords(qMin(extents.left(), r->left()), -
839 qMin(extents.top(), r->top()), -
840 qMax(extents.right(), r->right()), -
841 qMax(extents.bottom(), r->bottom())); -
842 -
843 -
844 -
845 -
846}
executed: }
Execution Count:4576
4576
847 -
848bool QRegionPrivate::canAppend(const QRect *r) const -
849{ -
850 qt_noop(); -
851 -
852 const QRect *myLast = (numRects == 1) ? &extents : (rects.constData() + (numRects - 1));
evaluated: (numRects == 1)
TRUEFALSE
yes
Evaluation Count:13429
yes
Evaluation Count:23598
13429-23598
853 if (r->top() > myLast->bottom())
evaluated: r->top() > myLast->bottom()
TRUEFALSE
yes
Evaluation Count:7528
yes
Evaluation Count:29499
7528-29499
854 return true;
executed: return true;
Execution Count:7528
7528
855 if (r->top() == myLast->top()
evaluated: r->top() == myLast->top()
TRUEFALSE
yes
Evaluation Count:7364
yes
Evaluation Count:22135
7364-22135
856 && r->height() == myLast->height()
evaluated: r->height() == myLast->height()
TRUEFALSE
yes
Evaluation Count:6009
yes
Evaluation Count:1355
1355-6009
857 && r->left() > myLast->right())
evaluated: r->left() > myLast->right()
TRUEFALSE
yes
Evaluation Count:4353
yes
Evaluation Count:1656
1656-4353
858 { -
859 return true;
executed: return true;
Execution Count:4353
4353
860 } -
861 -
862 return false;
executed: return false;
Execution Count:25146
25146
863} -
864 -
865bool QRegionPrivate::canAppend(const QRegionPrivate *r) const -
866{ -
867 return canAppend(r->numRects == 1 ? &r->extents : r->rects.constData());
executed: return canAppend(r->numRects == 1 ? &r->extents : r->rects.constData());
Execution Count:27912
27912
868} -
869 -
870bool QRegionPrivate::canPrepend(const QRect *r) const -
871{ -
872 qt_noop(); -
873 -
874 const QRect *myFirst = (numRects == 1) ? &extents : rects.constData();
evaluated: (numRects == 1)
TRUEFALSE
yes
Evaluation Count:6497
yes
Evaluation Count:18649
6497-18649
875 if (r->bottom() < myFirst->top())
evaluated: r->bottom() < myFirst->top()
TRUEFALSE
yes
Evaluation Count:3070
yes
Evaluation Count:22076
3070-22076
876 return true;
executed: return true;
Execution Count:3070
3070
877 if (r->top() == myFirst->top()
evaluated: r->top() == myFirst->top()
TRUEFALSE
yes
Evaluation Count:11999
yes
Evaluation Count:10077
10077-11999
878 && r->height() == myFirst->height()
evaluated: r->height() == myFirst->height()
TRUEFALSE
yes
Evaluation Count:7254
yes
Evaluation Count:4745
4745-7254
879 && r->right() < myFirst->left())
evaluated: r->right() < myFirst->left()
TRUEFALSE
yes
Evaluation Count:2001
yes
Evaluation Count:5253
2001-5253
880 { -
881 return true;
executed: return true;
Execution Count:2001
2001
882 } -
883 -
884 return false;
executed: return false;
Execution Count:20075
20075
885} -
886 -
887bool QRegionPrivate::canPrepend(const QRegionPrivate *r) const -
888{ -
889 return canPrepend(r->numRects == 1 ? &r->extents : r->rects.constData() + r->numRects - 1);
executed: return canPrepend(r->numRects == 1 ? &r->extents : r->rects.constData() + r->numRects - 1);
Execution Count:18570
18570
890} -
891static QRegionPrivate qrp; -
892QRegion::QRegionData QRegion::shared_empty = {{ (1) }, &qrp}; -
893 -
894typedef void (*OverlapFunc)(register QRegionPrivate &dest, register const QRect *r1, const QRect *r1End, -
895 register const QRect *r2, const QRect *r2End, register int y1, register int y2); -
896typedef void (*NonOverlapFunc)(register QRegionPrivate &dest, register const QRect *r, const QRect *rEnd, -
897 register int y1, register int y2); -
898 -
899static bool EqualRegion(const QRegionPrivate *r1, const QRegionPrivate *r2); -
900static void UnionRegion(const QRegionPrivate *reg1, const QRegionPrivate *reg2, QRegionPrivate &dest); -
901static void miRegionOp(register QRegionPrivate &dest, const QRegionPrivate *reg1, const QRegionPrivate *reg2, -
902 OverlapFunc overlapFunc, NonOverlapFunc nonOverlap1Func, -
903 NonOverlapFunc nonOverlap2Func); -
904 -
905 -
906typedef struct _POINTBLOCK { -
907 int data[200 * sizeof(QPoint)]; -
908 QPoint *pts; -
909 struct _POINTBLOCK *next; -
910} POINTBLOCK; -
911static void UnionRectWithRegion(register const QRect *rect, const QRegionPrivate *source, -
912 QRegionPrivate &dest) -
913{ -
914 if (rect->isEmpty())
partially evaluated: rect->isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:315
0-315
915 return;
never executed: return;
0
916 -
917 qt_noop(); -
918 -
919 if (dest.numRects == 0) {
evaluated: dest.numRects == 0
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:310
5-310
920 dest = QRegionPrivate(*rect); -
921 } else if (dest.canAppend(rect)) {
executed: }
Execution Count:5
partially evaluated: dest.canAppend(rect)
TRUEFALSE
yes
Evaluation Count:310
no
Evaluation Count:0
0-310
922 dest.append(rect); -
923 } else {
executed: }
Execution Count:310
310
924 QRegionPrivate p(*rect); -
925 UnionRegion(&p, source, dest); -
926 }
never executed: }
0
927} -
928static void miSetExtents(QRegionPrivate &dest) -
929{ -
930 register const QRect *pBox, -
931 *pBoxEnd; -
932 register QRect *pExtents; -
933 -
934 dest.innerRect.setCoords(0, 0, -1, -1); -
935 dest.innerArea = -1; -
936 if (dest.numRects == 0) {
evaluated: dest.numRects == 0
TRUEFALSE
yes
Evaluation Count:121
yes
Evaluation Count:15074
121-15074
937 dest.extents.setCoords(0, 0, -1, -1); -
938 return;
executed: return;
Execution Count:121
121
939 } -
940 -
941 pExtents = &dest.extents; -
942 if (dest.rects.isEmpty())
partially evaluated: dest.rects.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:15074
0-15074
943 pBox = &dest.extents;
never executed: pBox = &dest.extents;
0
944 else -
945 pBox = dest.rects.constData();
executed: pBox = dest.rects.constData();
Execution Count:15074
15074
946 pBoxEnd = pBox + dest.numRects - 1; -
947 pExtents->setLeft(pBox->left()); -
948 pExtents->setTop(pBox->top()); -
949 pExtents->setRight(pBoxEnd->right()); -
950 pExtents->setBottom(pBoxEnd->bottom()); -
951 -
952 qt_noop(); -
953 while (pBox <= pBoxEnd) {
evaluated: pBox <= pBoxEnd
TRUEFALSE
yes
Evaluation Count:54212
yes
Evaluation Count:15074
15074-54212
954 if (pBox->left() < pExtents->left())
evaluated: pBox->left() < pExtents->left()
TRUEFALSE
yes
Evaluation Count:1293
yes
Evaluation Count:52919
1293-52919
955 pExtents->setLeft(pBox->left());
executed: pExtents->setLeft(pBox->left());
Execution Count:1293
1293
956 if (pBox->right() > pExtents->right())
evaluated: pBox->right() > pExtents->right()
TRUEFALSE
yes
Evaluation Count:1352
yes
Evaluation Count:52860
1352-52860
957 pExtents->setRight(pBox->right());
executed: pExtents->setRight(pBox->right());
Execution Count:1352
1352
958 dest.updateInnerRect(*pBox); -
959 ++pBox; -
960 }
executed: }
Execution Count:54212
54212
961 qt_noop(); -
962}
executed: }
Execution Count:15074
15074
963 -
964 -
965 -
966 -
967 -
968 -
969static void OffsetRegion(register QRegionPrivate &region, register int x, register int y) -
970{ -
971 if (region.rects.size()) {
evaluated: region.rects.size()
TRUEFALSE
yes
Evaluation Count:14078
yes
Evaluation Count:37047
14078-37047
972 register QRect *pbox = region.rects.data(); -
973 register int nbox = region.numRects; -
974 -
975 while (nbox--) {
evaluated: nbox--
TRUEFALSE
yes
Evaluation Count:376133
yes
Evaluation Count:14078
14078-376133
976 pbox->translate(x, y); -
977 ++pbox; -
978 }
executed: }
Execution Count:376133
376133
979 }
executed: }
Execution Count:14078
14078
980 region.extents.translate(x, y); -
981 region.innerRect.translate(x, y); -
982}
executed: }
Execution Count:51125
51125
983static void miIntersectO(register QRegionPrivate &dest, register const QRect *r1, const QRect *r1End, -
984 register const QRect *r2, const QRect *r2End, int y1, int y2) -
985{ -
986 register int x1; -
987 register int x2; -
988 register QRect *pNextRect; -
989 -
990 pNextRect = dest.rects.data() + dest.numRects; -
991 -
992 while (r1 != r1End && r2 != r2End) {
evaluated: r1 != r1End
TRUEFALSE
yes
Evaluation Count:977
yes
Evaluation Count:495
evaluated: r2 != r2End
TRUEFALSE
yes
Evaluation Count:768
yes
Evaluation Count:209
209-977
993 x1 = qMax(r1->left(), r2->left()); -
994 x2 = qMin(r1->right(), r2->right()); -
995 if (x1 <= x2) {
partially evaluated: x1 <= x2
TRUEFALSE
yes
Evaluation Count:768
no
Evaluation Count:0
0-768
996 qt_noop(); -
997 { if ((dest).numRects >= ((dest).rects.size()-1)){ dest.rects.resize(dest.rects.size() * 2); (pNextRect) = (dest.rects).data() + (dest).numRects; } }
never executed: }
partially evaluated: (dest).numRects >= ((dest).rects.size()-1)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:768
0-768
998 pNextRect->setCoords(x1, y1, x2, y2); -
999 ++dest.numRects; -
1000 ++pNextRect; -
1001 }
executed: }
Execution Count:768
768
1002 -
1003 -
1004 -
1005 -
1006 -
1007 -
1008 if (r1->right() < r2->right()) {
evaluated: r1->right() < r2->right()
TRUEFALSE
yes
Evaluation Count:199
yes
Evaluation Count:569
199-569
1009 ++r1; -
1010 } else if (r2->right() < r1->right()) {
executed: }
Execution Count:199
evaluated: r2->right() < r1->right()
TRUEFALSE
yes
Evaluation Count:235
yes
Evaluation Count:334
199-334
1011 ++r2; -
1012 } else {
executed: }
Execution Count:235
235
1013 ++r1; -
1014 ++r2; -
1015 }
executed: }
Execution Count:334
334
1016 } -
1017}
executed: }
Execution Count:704
704
1018static int miCoalesce(register QRegionPrivate &dest, int prevStart, int curStart) -
1019{ -
1020 register QRect *pPrevBox; -
1021 register QRect *pCurBox; -
1022 register QRect *pRegEnd; -
1023 int curNumRects; -
1024 int prevNumRects; -
1025 int bandY1; -
1026 QRect *rData = dest.rects.data(); -
1027 -
1028 pRegEnd = rData + dest.numRects; -
1029 -
1030 pPrevBox = rData + prevStart; -
1031 prevNumRects = curStart - prevStart; -
1032 -
1033 -
1034 -
1035 -
1036 -
1037 -
1038 pCurBox = rData + curStart; -
1039 bandY1 = pCurBox->top(); -
1040 for (curNumRects = 0; pCurBox != pRegEnd && pCurBox->top() == bandY1; ++curNumRects) {
evaluated: pCurBox != pRegEnd
TRUEFALSE
yes
Evaluation Count:132327
yes
Evaluation Count:92085
evaluated: pCurBox->top() == bandY1
TRUEFALSE
yes
Evaluation Count:127488
yes
Evaluation Count:4839
4839-132327
1041 ++pCurBox; -
1042 }
executed: }
Execution Count:127488
127488
1043 -
1044 if (pCurBox != pRegEnd) {
evaluated: pCurBox != pRegEnd
TRUEFALSE
yes
Evaluation Count:4839
yes
Evaluation Count:92085
4839-92085
1045 -
1046 -
1047 -
1048 -
1049 -
1050 -
1051 --pRegEnd; -
1052 while ((pRegEnd - 1)->top() == pRegEnd->top())
evaluated: (pRegEnd - 1)->top() == pRegEnd->top()
TRUEFALSE
yes
Evaluation Count:217
yes
Evaluation Count:4839
217-4839
1053 --pRegEnd;
executed: --pRegEnd;
Execution Count:217
217
1054 curStart = pRegEnd - rData; -
1055 pRegEnd = rData + dest.numRects; -
1056 }
executed: }
Execution Count:4839
4839
1057 -
1058 if (curNumRects == prevNumRects && curNumRects != 0) {
evaluated: curNumRects == prevNumRects
TRUEFALSE
yes
Evaluation Count:40656
yes
Evaluation Count:56268
partially evaluated: curNumRects != 0
TRUEFALSE
yes
Evaluation Count:40656
no
Evaluation Count:0
0-56268
1059 pCurBox -= curNumRects; -
1060 -
1061 -
1062 -
1063 -
1064 if (pPrevBox->bottom() == pCurBox->top() - 1) {
evaluated: pPrevBox->bottom() == pCurBox->top() - 1
TRUEFALSE
yes
Evaluation Count:37167
yes
Evaluation Count:3489
3489-37167
1065 -
1066 -
1067 -
1068 -
1069 -
1070 -
1071 do { -
1072 if (pPrevBox->left() != pCurBox->left() || pPrevBox->right() != pCurBox->right()) {
evaluated: pPrevBox->left() != pCurBox->left()
TRUEFALSE
yes
Evaluation Count:20526
yes
Evaluation Count:17493
evaluated: pPrevBox->right() != pCurBox->right()
TRUEFALSE
yes
Evaluation Count:12043
yes
Evaluation Count:5450
5450-20526
1073 -
1074 return curStart;
executed: return curStart;
Execution Count:32569
32569
1075 } -
1076 ++pPrevBox; -
1077 ++pCurBox; -
1078 --prevNumRects; -
1079 } while (prevNumRects != 0);
executed: }
Execution Count:5450
evaluated: prevNumRects != 0
TRUEFALSE
yes
Evaluation Count:852
yes
Evaluation Count:4598
852-5450
1080 -
1081 dest.numRects -= curNumRects; -
1082 pCurBox -= curNumRects; -
1083 pPrevBox -= curNumRects; -
1084 -
1085 -
1086 -
1087 -
1088 -
1089 -
1090 do { -
1091 pPrevBox->setBottom(pCurBox->bottom()); -
1092 dest.updateInnerRect(*pPrevBox); -
1093 ++pPrevBox; -
1094 ++pCurBox; -
1095 curNumRects -= 1; -
1096 } while (curNumRects != 0);
executed: }
Execution Count:4914
evaluated: curNumRects != 0
TRUEFALSE
yes
Evaluation Count:316
yes
Evaluation Count:4598
316-4914
1097 if (pCurBox == pRegEnd) {
evaluated: pCurBox == pRegEnd
TRUEFALSE
yes
Evaluation Count:4500
yes
Evaluation Count:98
98-4500
1098 curStart = prevStart; -
1099 } else {
executed: }
Execution Count:4500
4500
1100 do { -
1101 *pPrevBox++ = *pCurBox++; -
1102 dest.updateInnerRect(*pPrevBox); -
1103 } while (pCurBox != pRegEnd);
executed: }
Execution Count:184
evaluated: pCurBox != pRegEnd
TRUEFALSE
yes
Evaluation Count:86
yes
Evaluation Count:98
86-184
1104 }
executed: }
Execution Count:98
98
1105 } -
1106 }
executed: }
Execution Count:8087
8087
1107 return curStart;
executed: return curStart;
Execution Count:64355
64355
1108} -
1109static void miRegionOp(register QRegionPrivate &dest, -
1110 const QRegionPrivate *reg1, const QRegionPrivate *reg2, -
1111 OverlapFunc overlapFunc, NonOverlapFunc nonOverlap1Func, -
1112 NonOverlapFunc nonOverlap2Func) -
1113{ -
1114 register const QRect *r1; -
1115 register const QRect *r2; -
1116 const QRect *r1End; -
1117 const QRect *r2End; -
1118 register int ybot; -
1119 register int ytop; -
1120 int prevBand; -
1121 int curBand; -
1122 register const QRect *r1BandEnd; -
1123 register const QRect *r2BandEnd; -
1124 int top; -
1125 int bot; -
1126 if (reg1->numRects == 1)
evaluated: reg1->numRects == 1
TRUEFALSE
yes
Evaluation Count:13480
yes
Evaluation Count:21576
13480-21576
1127 r1 = &reg1->extents;
executed: r1 = &reg1->extents;
Execution Count:13480
13480
1128 else -
1129 r1 = reg1->rects.constData();
executed: r1 = reg1->rects.constData();
Execution Count:21576
21576
1130 if (reg2->numRects == 1)
evaluated: reg2->numRects == 1
TRUEFALSE
yes
Evaluation Count:32302
yes
Evaluation Count:2754
2754-32302
1131 r2 = &reg2->extents;
executed: r2 = &reg2->extents;
Execution Count:32302
32302
1132 else -
1133 r2 = reg2->rects.constData();
executed: r2 = reg2->rects.constData();
Execution Count:2754
2754
1134 -
1135 r1End = r1 + reg1->numRects; -
1136 r2End = r2 + reg2->numRects; -
1137 -
1138 dest.vectorize(); -
1139 -
1140 QVector<QRect> oldRects = dest.rects; -
1141 -
1142 dest.numRects = 0; -
1143 dest.rects.resize(qMax(reg1->numRects,reg2->numRects) * 2); -
1144 if (reg1->extents.top() < reg2->extents.top())
evaluated: reg1->extents.top() < reg2->extents.top()
TRUEFALSE
yes
Evaluation Count:18733
yes
Evaluation Count:16323
16323-18733
1145 ybot = reg1->extents.top() - 1;
executed: ybot = reg1->extents.top() - 1;
Execution Count:18733
18733
1146 else -
1147 ybot = reg2->extents.top() - 1;
executed: ybot = reg2->extents.top() - 1;
Execution Count:16323
16323
1148 prevBand = 0; -
1149 -
1150 do { -
1151 curBand = dest.numRects; -
1152 r1BandEnd = r1; -
1153 while (r1BandEnd != r1End && r1BandEnd->top() == r1->top())
evaluated: r1BandEnd != r1End
TRUEFALSE
yes
Evaluation Count:128573
yes
Evaluation Count:24365
evaluated: r1BandEnd->top() == r1->top()
TRUEFALSE
yes
Evaluation Count:86971
yes
Evaluation Count:41602
24365-128573
1154 ++r1BandEnd;
executed: ++r1BandEnd;
Execution Count:86971
86971
1155 -
1156 r2BandEnd = r2; -
1157 while (r2BandEnd != r2End && r2BandEnd->top() == r2->top())
evaluated: r2BandEnd != r2End
TRUEFALSE
yes
Evaluation Count:75476
yes
Evaluation Count:58436
evaluated: r2BandEnd->top() == r2->top()
TRUEFALSE
yes
Evaluation Count:67945
yes
Evaluation Count:7531
7531-75476
1158 ++r2BandEnd;
executed: ++r2BandEnd;
Execution Count:67945
67945
1159 if (r1->top() < r2->top()) {
evaluated: r1->top() < r2->top()
TRUEFALSE
yes
Evaluation Count:25210
yes
Evaluation Count:40757
25210-40757
1160 top = qMax(r1->top(), ybot + 1); -
1161 bot = qMin(r1->bottom(), r2->top() - 1); -
1162 -
1163 if (nonOverlap1Func != 0 && bot >= top)
evaluated: nonOverlap1Func != 0
TRUEFALSE
yes
Evaluation Count:24975
yes
Evaluation Count:235
evaluated: bot >= top
TRUEFALSE
yes
Evaluation Count:22867
yes
Evaluation Count:2108
235-24975
1164 (*nonOverlap1Func)(dest, r1, r1BandEnd, top, bot);
executed: (*nonOverlap1Func)(dest, r1, r1BandEnd, top, bot);
Execution Count:22867
22867
1165 ytop = r2->top(); -
1166 } else if (r2->top() < r1->top()) {
executed: }
Execution Count:25210
evaluated: r2->top() < r1->top()
TRUEFALSE
yes
Evaluation Count:13188
yes
Evaluation Count:27569
13188-27569
1167 top = qMax(r2->top(), ybot + 1); -
1168 bot = qMin(r2->bottom(), r1->top() - 1); -
1169 -
1170 if (nonOverlap2Func != 0 && bot >= top)
evaluated: nonOverlap2Func != 0
TRUEFALSE
yes
Evaluation Count:12366
yes
Evaluation Count:822
evaluated: bot >= top
TRUEFALSE
yes
Evaluation Count:1739
yes
Evaluation Count:10627
822-12366
1171 (*nonOverlap2Func)(dest, r2, r2BandEnd, top, bot);
executed: (*nonOverlap2Func)(dest, r2, r2BandEnd, top, bot);
Execution Count:1739
1739
1172 ytop = r1->top(); -
1173 } else {
executed: }
Execution Count:13188
13188
1174 ytop = r1->top(); -
1175 }
executed: }
Execution Count:27569
27569
1176 -
1177 -
1178 -
1179 -
1180 -
1181 -
1182 -
1183 if (dest.numRects != curBand)
evaluated: dest.numRects != curBand
TRUEFALSE
yes
Evaluation Count:24606
yes
Evaluation Count:41361
24606-41361
1184 prevBand = miCoalesce(dest, prevBand, curBand);
executed: prevBand = miCoalesce(dest, prevBand, curBand);
Execution Count:24606
24606
1185 -
1186 -
1187 -
1188 -
1189 -
1190 ybot = qMin(r1->bottom(), r2->bottom()); -
1191 curBand = dest.numRects; -
1192 if (ybot >= ytop)
evaluated: ybot >= ytop
TRUEFALSE
yes
Evaluation Count:50028
yes
Evaluation Count:15939
15939-50028
1193 (*overlapFunc)(dest, r1, r1BandEnd, r2, r2BandEnd, ytop, ybot);
executed: (*overlapFunc)(dest, r1, r1BandEnd, r2, r2BandEnd, ytop, ybot);
Execution Count:50028
50028
1194 -
1195 if (dest.numRects != curBand)
evaluated: dest.numRects != curBand
TRUEFALSE
yes
Evaluation Count:48108
yes
Evaluation Count:17859
17859-48108
1196 prevBand = miCoalesce(dest, prevBand, curBand);
executed: prevBand = miCoalesce(dest, prevBand, curBand);
Execution Count:48108
48108
1197 -
1198 -
1199 -
1200 -
1201 -
1202 if (r1->bottom() == ybot)
evaluated: r1->bottom() == ybot
TRUEFALSE
yes
Evaluation Count:53500
yes
Evaluation Count:12467
12467-53500
1203 r1 = r1BandEnd;
executed: r1 = r1BandEnd;
Execution Count:53500
53500
1204 if (r2->bottom() == ybot)
evaluated: r2->bottom() == ybot
TRUEFALSE
yes
Evaluation Count:38387
yes
Evaluation Count:27580
27580-38387
1205 r2 = r2BandEnd;
executed: r2 = r2BandEnd;
Execution Count:38387
38387
1206 } while (r1 != r1End && r2 != r2End);
executed: }
Execution Count:65967
evaluated: r1 != r1End
TRUEFALSE
yes
Evaluation Count:53220
yes
Evaluation Count:12747
evaluated: r2 != r2End
TRUEFALSE
yes
Evaluation Count:30911
yes
Evaluation Count:22309
12747-65967
1207 -
1208 -
1209 -
1210 -
1211 curBand = dest.numRects; -
1212 if (r1 != r1End) {
evaluated: r1 != r1End
TRUEFALSE
yes
Evaluation Count:22309
yes
Evaluation Count:12747
12747-22309
1213 if (nonOverlap1Func != 0) {
evaluated: nonOverlap1Func != 0
TRUEFALSE
yes
Evaluation Count:22305
yes
Evaluation Count:4
4-22305
1214 do { -
1215 r1BandEnd = r1; -
1216 while (r1BandEnd < r1End && r1BandEnd->top() == r1->top())
evaluated: r1BandEnd < r1End
TRUEFALSE
yes
Evaluation Count:33554
yes
Evaluation Count:22305
evaluated: r1BandEnd->top() == r1->top()
TRUEFALSE
yes
Evaluation Count:28361
yes
Evaluation Count:5193
5193-33554
1217 ++r1BandEnd;
executed: ++r1BandEnd;
Execution Count:28361
28361
1218 (*nonOverlap1Func)(dest, r1, r1BandEnd, qMax(r1->top(), ybot + 1), r1->bottom()); -
1219 r1 = r1BandEnd; -
1220 } while (r1 != r1End);
executed: }
Execution Count:27498
evaluated: r1 != r1End
TRUEFALSE
yes
Evaluation Count:5193
yes
Evaluation Count:22305
5193-27498
1221 }
executed: }
Execution Count:22305
22305
1222 } else if ((r2 != r2End) && (nonOverlap2Func != 0)) {
executed: }
Execution Count:22309
evaluated: (r2 != r2End)
TRUEFALSE
yes
Evaluation Count:2311
yes
Evaluation Count:10436
evaluated: (nonOverlap2Func != 0)
TRUEFALSE
yes
Evaluation Count:1905
yes
Evaluation Count:406
406-22309
1223 do { -
1224 r2BandEnd = r2; -
1225 while (r2BandEnd < r2End && r2BandEnd->top() == r2->top())
evaluated: r2BandEnd < r2End
TRUEFALSE
yes
Evaluation Count:2198
yes
Evaluation Count:1905
evaluated: r2BandEnd->top() == r2->top()
TRUEFALSE
yes
Evaluation Count:2092
yes
Evaluation Count:106
106-2198
1226 ++r2BandEnd;
executed: ++r2BandEnd;
Execution Count:2092
2092
1227 (*nonOverlap2Func)(dest, r2, r2BandEnd, qMax(r2->top(), ybot + 1), r2->bottom()); -
1228 r2 = r2BandEnd; -
1229 } while (r2 != r2End);
executed: }
Execution Count:2011
evaluated: r2 != r2End
TRUEFALSE
yes
Evaluation Count:106
yes
Evaluation Count:1905
106-2011
1230 }
executed: }
Execution Count:1905
1905
1231 -
1232 if (dest.numRects != curBand)
evaluated: dest.numRects != curBand
TRUEFALSE
yes
Evaluation Count:24210
yes
Evaluation Count:10846
10846-24210
1233 (void)miCoalesce(dest, prevBand, curBand);
executed: (void)miCoalesce(dest, prevBand, curBand);
Execution Count:24210
24210
1234 if (qMax(4, dest.numRects) < (dest.rects.size() >> 1))
evaluated: qMax(4, dest.numRects) < (dest.rects.size() >> 1)
TRUEFALSE
yes
Evaluation Count:337
yes
Evaluation Count:34719
337-34719
1235 dest.rects.resize(dest.numRects);
executed: dest.rects.resize(dest.numRects);
Execution Count:337
337
1236}
executed: }
Execution Count:35056
35056
1237static void miUnionNonO(register QRegionPrivate &dest, register const QRect *r, const QRect *rEnd, -
1238 register int y1, register int y2) -
1239{ -
1240 register QRect *pNextRect; -
1241 -
1242 pNextRect = dest.rects.data() + dest.numRects; -
1243 -
1244 qt_noop(); -
1245 -
1246 while (r != rEnd) {
evaluated: r != rEnd
TRUEFALSE
yes
Evaluation Count:37295
yes
Evaluation Count:31946
31946-37295
1247 qt_noop(); -
1248 { if ((dest).numRects >= ((dest).rects.size()-1)){ dest.rects.resize(dest.rects.size() * 2); (pNextRect) = (dest.rects).data() + (dest).numRects; } }
executed: }
Execution Count:10187
evaluated: (dest).numRects >= ((dest).rects.size()-1)
TRUEFALSE
yes
Evaluation Count:10187
yes
Evaluation Count:27108
10187-27108
1249 pNextRect->setCoords(r->left(), y1, r->right(), y2); -
1250 dest.numRects++; -
1251 ++pNextRect; -
1252 ++r; -
1253 }
executed: }
Execution Count:37295
37295
1254}
executed: }
Execution Count:31946
31946
1255static void miUnionO(register QRegionPrivate &dest, register const QRect *r1, const QRect *r1End, -
1256 register const QRect *r2, const QRect *r2End, register int y1, register int y2) -
1257{ -
1258 register QRect *pNextRect; -
1259 -
1260 pNextRect = dest.rects.data() + dest.numRects; -
1261 qt_noop(); -
1262 while (r1 != r1End && r2 != r2End) {
evaluated: r1 != r1End
TRUEFALSE
yes
Evaluation Count:56341
yes
Evaluation Count:14479
evaluated: r2 != r2End
TRUEFALSE
yes
Evaluation Count:38238
yes
Evaluation Count:18103
14479-56341
1263 if (r1->left() < r2->left()) {
evaluated: r1->left() < r2->left()
TRUEFALSE
yes
Evaluation Count:19133
yes
Evaluation Count:19105
19105-19133
1264 if ((dest.numRects != 0) && (pNextRect[-1].top() == y1) && (pNextRect[-1].bottom() == y2) && (pNextRect[-1].right() >= r1->left()-1)) { if (pNextRect[-1].right() < r1->right()) { pNextRect[-1].setRight(r1->right()); dest.updateInnerRect(pNextRect[-1]); qt_noop(); } } else { { if ((dest).numRects >= ((dest).rects.size()-1)){ dest.rects.resize(dest.rects.size() * 2); (pNextRect) = (dest.rects).data() + (dest).numRects; } } pNextRect->setCoords(r1->left(), y1, r1->right(), y2); dest.updateInnerRect(*pNextRect); dest.numRects++; pNextRect++; } r1++;
executed: }
Execution Count:864
executed: }
Execution Count:900
executed: }
Execution Count:8578
executed: }
Execution Count:18233
evaluated: pNextRect[-1].right() < r1->right()
TRUEFALSE
yes
Evaluation Count:864
yes
Evaluation Count:36
evaluated: (dest).numRects >= ((dest).rects.size()-1)
TRUEFALSE
yes
Evaluation Count:8578
yes
Evaluation Count:9655
evaluated: (dest.numRects != 0)
TRUEFALSE
yes
Evaluation Count:17041
yes
Evaluation Count:2092
evaluated: (pNextRect[-1].top() == y1)
TRUEFALSE
yes
Evaluation Count:4843
yes
Evaluation Count:12198
partially evaluated: (pNextRect[-1].bottom() == y2)
TRUEFALSE
yes
Evaluation Count:4843
no
Evaluation Count:0
evaluated: (pNextRect[-1].right() >= r1->left()-1)
TRUEFALSE
yes
Evaluation Count:900
yes
Evaluation Count:3943
0-18233
1265 } else {
executed: }
Execution Count:19133
19133
1266 if ((dest.numRects != 0) && (pNextRect[-1].top() == y1) && (pNextRect[-1].bottom() == y2) && (pNextRect[-1].right() >= r2->left()-1)) { if (pNextRect[-1].right() < r2->right()) { pNextRect[-1].setRight(r2->right()); dest.updateInnerRect(pNextRect[-1]); qt_noop(); } } else { { if ((dest).numRects >= ((dest).rects.size()-1)){ dest.rects.resize(dest.rects.size() * 2); (pNextRect) = (dest.rects).data() + (dest).numRects; } } pNextRect->setCoords(r2->left(), y1, r2->right(), y2); dest.updateInnerRect(*pNextRect); dest.numRects++; pNextRect++; } r2++;
executed: }
Execution Count:285
executed: }
Execution Count:357
executed: }
Execution Count:2966
executed: }
Execution Count:18748
evaluated: pNextRect[-1].right() < r2->right()
TRUEFALSE
yes
Evaluation Count:285
yes
Evaluation Count:72
evaluated: (dest).numRects >= ((dest).rects.size()-1)
TRUEFALSE
yes
Evaluation Count:2966
yes
Evaluation Count:15782
evaluated: (dest.numRects != 0)
TRUEFALSE
yes
Evaluation Count:10259
yes
Evaluation Count:8846
evaluated: (pNextRect[-1].top() == y1)
TRUEFALSE
yes
Evaluation Count:813
yes
Evaluation Count:9446
partially evaluated: (pNextRect[-1].bottom() == y2)
TRUEFALSE
yes
Evaluation Count:813
no
Evaluation Count:0
evaluated: (pNextRect[-1].right() >= r2->left()-1)
TRUEFALSE
yes
Evaluation Count:357
yes
Evaluation Count:456
0-18748
1267 }
executed: }
Execution Count:19105
19105
1268 } -
1269 -
1270 if (r1 != r1End) {
evaluated: r1 != r1End
TRUEFALSE
yes
Evaluation Count:18103
yes
Evaluation Count:14479
14479-18103
1271 do { -
1272 if ((dest.numRects != 0) && (pNextRect[-1].top() == y1) && (pNextRect[-1].bottom() == y2) && (pNextRect[-1].right() >= r1->left()-1)) { if (pNextRect[-1].right() < r1->right()) { pNextRect[-1].setRight(r1->right()); dest.updateInnerRect(pNextRect[-1]); qt_noop(); } } else { { if ((dest).numRects >= ((dest).rects.size()-1)){ dest.rects.resize(dest.rects.size() * 2); (pNextRect) = (dest.rects).data() + (dest).numRects; } } pNextRect->setCoords(r1->left(), y1, r1->right(), y2); dest.updateInnerRect(*pNextRect); dest.numRects++; pNextRect++; } r1++;
executed: }
Execution Count:10634
executed: }
Execution Count:17764
executed: }
Execution Count:507
executed: }
Execution Count:2709
evaluated: pNextRect[-1].right() < r1->right()
TRUEFALSE
yes
Evaluation Count:10634
yes
Evaluation Count:7130
evaluated: (dest).numRects >= ((dest).rects.size()-1)
TRUEFALSE
yes
Evaluation Count:507
yes
Evaluation Count:2202
partially evaluated: (dest.numRects != 0)
TRUEFALSE
yes
Evaluation Count:20473
no
Evaluation Count:0
partially evaluated: (pNextRect[-1].top() == y1)
TRUEFALSE
yes
Evaluation Count:20473
no
Evaluation Count:0
partially evaluated: (pNextRect[-1].bottom() == y2)
TRUEFALSE
yes
Evaluation Count:20473
no
Evaluation Count:0
evaluated: (pNextRect[-1].right() >= r1->left()-1)
TRUEFALSE
yes
Evaluation Count:17764
yes
Evaluation Count:2709
0-20473
1273 } while (r1 != r1End);
executed: }
Execution Count:20473
evaluated: r1 != r1End
TRUEFALSE
yes
Evaluation Count:2370
yes
Evaluation Count:18103
2370-20473
1274 } else {
executed: }
Execution Count:18103
18103
1275 while (r2 != r2End) {
evaluated: r2 != r2End
TRUEFALSE
yes
Evaluation Count:14945
yes
Evaluation Count:14479
14479-14945
1276 if ((dest.numRects != 0) && (pNextRect[-1].top() == y1) && (pNextRect[-1].bottom() == y2) && (pNextRect[-1].right() >= r2->left()-1)) { if (pNextRect[-1].right() < r2->right()) { pNextRect[-1].setRight(r2->right()); dest.updateInnerRect(pNextRect[-1]); qt_noop(); } } else { { if ((dest).numRects >= ((dest).rects.size()-1)){ dest.rects.resize(dest.rects.size() * 2); (pNextRect) = (dest.rects).data() + (dest).numRects; } } pNextRect->setCoords(r2->left(), y1, r2->right(), y2); dest.updateInnerRect(*pNextRect); dest.numRects++; pNextRect++; } r2++;
executed: }
Execution Count:5045
executed: }
Execution Count:13537
executed: }
Execution Count:250
executed: }
Execution Count:1408
evaluated: pNextRect[-1].right() < r2->right()
TRUEFALSE
yes
Evaluation Count:5045
yes
Evaluation Count:8492
evaluated: (dest).numRects >= ((dest).rects.size()-1)
TRUEFALSE
yes
Evaluation Count:250
yes
Evaluation Count:1158
partially evaluated: (dest.numRects != 0)
TRUEFALSE
yes
Evaluation Count:14945
no
Evaluation Count:0
partially evaluated: (pNextRect[-1].top() == y1)
TRUEFALSE
yes
Evaluation Count:14945
no
Evaluation Count:0
partially evaluated: (pNextRect[-1].bottom() == y2)
TRUEFALSE
yes
Evaluation Count:14945
no
Evaluation Count:0
evaluated: (pNextRect[-1].right() >= r2->left()-1)
TRUEFALSE
yes
Evaluation Count:13537
yes
Evaluation Count:1408
0-14945
1277 }
executed: }
Execution Count:14945
14945
1278 }
executed: }
Execution Count:14479
14479
1279} -
1280 -
1281static void UnionRegion(const QRegionPrivate *reg1, const QRegionPrivate *reg2, QRegionPrivate &dest) -
1282{ -
1283 qt_noop(); -
1284 qt_noop(); -
1285 qt_noop(); -
1286 qt_noop(); -
1287 qt_noop(); -
1288 qt_noop(); -
1289 -
1290 if (reg1->innerArea > reg2->innerArea) {
evaluated: reg1->innerArea > reg2->innerArea
TRUEFALSE
yes
Evaluation Count:16866
yes
Evaluation Count:2995
2995-16866
1291 dest.innerArea = reg1->innerArea; -
1292 dest.innerRect = reg1->innerRect; -
1293 } else {
executed: }
Execution Count:16866
16866
1294 dest.innerArea = reg2->innerArea; -
1295 dest.innerRect = reg2->innerRect; -
1296 }
executed: }
Execution Count:2995
2995
1297 miRegionOp(dest, reg1, reg2, miUnionO, miUnionNonO, miUnionNonO); -
1298 -
1299 dest.extents.setCoords(qMin(reg1->extents.left(), reg2->extents.left()), -
1300 qMin(reg1->extents.top(), reg2->extents.top()), -
1301 qMax(reg1->extents.right(), reg2->extents.right()), -
1302 qMax(reg1->extents.bottom(), reg2->extents.bottom())); -
1303}
executed: }
Execution Count:19861
19861
1304static void miSubtractNonO1(register QRegionPrivate &dest, register const QRect *r, -
1305 const QRect *rEnd, register int y1, register int y2) -
1306{ -
1307 register QRect *pNextRect; -
1308 -
1309 pNextRect = dest.rects.data() + dest.numRects; -
1310 -
1311 qt_noop(); -
1312 -
1313 while (r != rEnd) {
evaluated: r != rEnd
TRUEFALSE
yes
Evaluation Count:22270
yes
Evaluation Count:22169
22169-22270
1314 qt_noop(); -
1315 { if ((dest).numRects >= ((dest).rects.size()-1)){ dest.rects.resize(dest.rects.size() * 2); (pNextRect) = (dest.rects).data() + (dest).numRects; } }
executed: }
Execution Count:5312
evaluated: (dest).numRects >= ((dest).rects.size()-1)
TRUEFALSE
yes
Evaluation Count:5312
yes
Evaluation Count:16958
5312-16958
1316 pNextRect->setCoords(r->left(), y1, r->right(), y2); -
1317 ++dest.numRects; -
1318 ++pNextRect; -
1319 ++r; -
1320 }
executed: }
Execution Count:22270
22270
1321}
executed: }
Execution Count:22169
22169
1322static void miSubtractO(register QRegionPrivate &dest, register const QRect *r1, const QRect *r1End, -
1323 register const QRect *r2, const QRect *r2End, register int y1, register int y2) -
1324{ -
1325 register QRect *pNextRect; -
1326 register int x1; -
1327 -
1328 x1 = r1->left(); -
1329 -
1330 qt_noop(); -
1331 pNextRect = dest.rects.data() + dest.numRects; -
1332 -
1333 while (r1 != r1End && r2 != r2End) {
evaluated: r1 != r1End
TRUEFALSE
yes
Evaluation Count:36788
yes
Evaluation Count:4669
evaluated: r2 != r2End
TRUEFALSE
yes
Evaluation Count:24715
yes
Evaluation Count:12073
4669-36788
1334 if (r2->right() < x1) {
evaluated: r2->right() < x1
TRUEFALSE
yes
Evaluation Count:2076
yes
Evaluation Count:22639
2076-22639
1335 -
1336 -
1337 -
1338 ++r2; -
1339 } else if (r2->left() <= x1) {
executed: }
Execution Count:2076
evaluated: r2->left() <= x1
TRUEFALSE
yes
Evaluation Count:4859
yes
Evaluation Count:17780
2076-17780
1340 -
1341 -
1342 -
1343 x1 = r2->right() + 1; -
1344 if (x1 > r1->right()) {
evaluated: x1 > r1->right()
TRUEFALSE
yes
Evaluation Count:2007
yes
Evaluation Count:2852
2007-2852
1345 -
1346 -
1347 -
1348 -
1349 ++r1; -
1350 if (r1 != r1End)
evaluated: r1 != r1End
TRUEFALSE
yes
Evaluation Count:74
yes
Evaluation Count:1933
74-1933
1351 x1 = r1->left();
executed: x1 = r1->left();
Execution Count:74
74
1352 } else {
executed: }
Execution Count:2007
2007
1353 -
1354 ++r2; -
1355 }
executed: }
Execution Count:2852
2852
1356 } else if (r2->left() <= r1->right()) {
evaluated: r2->left() <= r1->right()
TRUEFALSE
yes
Evaluation Count:10177
yes
Evaluation Count:7603
7603-10177
1357 -
1358 -
1359 -
1360 -
1361 qt_noop(); -
1362 { if ((dest).numRects >= ((dest).rects.size()-1)){ dest.rects.resize(dest.rects.size() * 2); (pNextRect) = (dest.rects).data() + (dest).numRects; } }
executed: }
Execution Count:4942
evaluated: (dest).numRects >= ((dest).rects.size()-1)
TRUEFALSE
yes
Evaluation Count:4942
yes
Evaluation Count:5235
4942-5235
1363 pNextRect->setCoords(x1, y1, r2->left() - 1, y2); -
1364 ++dest.numRects; -
1365 ++pNextRect; -
1366 -
1367 x1 = r2->right() + 1; -
1368 if (x1 > r1->right()) {
evaluated: x1 > r1->right()
TRUEFALSE
yes
Evaluation Count:2709
yes
Evaluation Count:7468
2709-7468
1369 -
1370 -
1371 -
1372 ++r1; -
1373 if (r1 != r1End)
evaluated: r1 != r1End
TRUEFALSE
yes
Evaluation Count:35
yes
Evaluation Count:2674
35-2674
1374 x1 = r1->left();
executed: x1 = r1->left();
Execution Count:35
35
1375 } else {
executed: }
Execution Count:2709
2709
1376 -
1377 ++r2; -
1378 }
executed: }
Execution Count:7468
7468
1379 } else { -
1380 -
1381 -
1382 -
1383 if (r1->right() >= x1) {
partially evaluated: r1->right() >= x1
TRUEFALSE
yes
Evaluation Count:7603
no
Evaluation Count:0
0-7603
1384 { if ((dest).numRects >= ((dest).rects.size()-1)){ dest.rects.resize(dest.rects.size() * 2); (pNextRect) = (dest.rects).data() + (dest).numRects; } }
never executed: }
partially evaluated: (dest).numRects >= ((dest).rects.size()-1)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:7603
0-7603
1385 pNextRect->setCoords(x1, y1, r1->right(), y2); -
1386 ++dest.numRects; -
1387 ++pNextRect; -
1388 }
executed: }
Execution Count:7603
7603
1389 ++r1; -
1390 if (r1 != r1End)
evaluated: r1 != r1End
TRUEFALSE
yes
Evaluation Count:7541
yes
Evaluation Count:62
62-7541
1391 x1 = r1->left();
executed: x1 = r1->left();
Execution Count:7541
7541
1392 }
executed: }
Execution Count:7603
7603
1393 } -
1394 -
1395 -
1396 -
1397 -
1398 while (r1 != r1End) {
evaluated: r1 != r1End
TRUEFALSE
yes
Evaluation Count:14055
yes
Evaluation Count:16742
14055-16742
1399 qt_noop(); -
1400 { if ((dest).numRects >= ((dest).rects.size()-1)){ dest.rects.resize(dest.rects.size() * 2); (pNextRect) = (dest.rects).data() + (dest).numRects; } }
executed: }
Execution Count:1112
evaluated: (dest).numRects >= ((dest).rects.size()-1)
TRUEFALSE
yes
Evaluation Count:1112
yes
Evaluation Count:12943
1112-12943
1401 pNextRect->setCoords(x1, y1, r1->right(), y2); -
1402 ++dest.numRects; -
1403 ++pNextRect; -
1404 -
1405 ++r1; -
1406 if (r1 != r1End)
evaluated: r1 != r1End
TRUEFALSE
yes
Evaluation Count:1982
yes
Evaluation Count:12073
1982-12073
1407 x1 = r1->left();
executed: x1 = r1->left();
Execution Count:1982
1982
1408 }
executed: }
Execution Count:14055
14055
1409}
executed: }
Execution Count:16742
16742
1410static void SubtractRegion(QRegionPrivate *regM, QRegionPrivate *regS, -
1411 register QRegionPrivate &dest) -
1412{ -
1413 qt_noop(); -
1414 qt_noop(); -
1415 qt_noop(); -
1416 qt_noop(); -
1417 qt_noop(); -
1418 -
1419 miRegionOp(dest, regM, regS, miSubtractO, miSubtractNonO1, 0); -
1420 miSetExtents(dest); -
1421}
executed: }
Execution Count:15171
15171
1422 -
1423static void XorRegion(QRegionPrivate *sra, QRegionPrivate *srb, QRegionPrivate &dest) -
1424{ -
1425 qt_noop(); -
1426 qt_noop(); -
1427 qt_noop(); -
1428 -
1429 QRegionPrivate tra, trb; -
1430 -
1431 if (!srb->contains(*sra))
evaluated: !srb->contains(*sra)
TRUEFALSE
yes
Evaluation Count:16
yes
Evaluation Count:3
3-16
1432 SubtractRegion(sra, srb, tra);
executed: SubtractRegion(sra, srb, tra);
Execution Count:16
16
1433 if (!sra->contains(*srb))
evaluated: !sra->contains(*srb)
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:12
7-12
1434 SubtractRegion(srb, sra, trb);
executed: SubtractRegion(srb, sra, trb);
Execution Count:7
7
1435 -
1436 qt_noop(); -
1437 qt_noop(); -
1438 -
1439 if (isEmptyHelper(&tra)) {
evaluated: isEmptyHelper(&tra)
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:16
3-16
1440 dest = trb; -
1441 } else if (isEmptyHelper(&trb)) {
executed: }
Execution Count:3
partially evaluated: isEmptyHelper(&trb)
TRUEFALSE
yes
Evaluation Count:16
no
Evaluation Count:0
0-16
1442 dest = tra; -
1443 } else if (tra.canAppend(&trb)) {
executed: }
Execution Count:16
never evaluated: tra.canAppend(&trb)
0-16
1444 dest = tra; -
1445 dest.append(&trb); -
1446 } else if (trb.canAppend(&tra)) {
never executed: }
never evaluated: trb.canAppend(&tra)
0
1447 dest = trb; -
1448 dest.append(&tra); -
1449 } else {
never executed: }
0
1450 UnionRegion(&tra, &trb, dest); -
1451 }
never executed: }
0
1452} -
1453 -
1454 -
1455 -
1456 -
1457static bool EqualRegion(const QRegionPrivate *r1, const QRegionPrivate *r2) -
1458{ -
1459 if (r1->numRects != r2->numRects) {
evaluated: r1->numRects != r2->numRects
TRUEFALSE
yes
Evaluation Count:17244
yes
Evaluation Count:12519
12519-17244
1460 return false;
executed: return false;
Execution Count:17244
17244
1461 } else if (r1->numRects == 0) {
evaluated: r1->numRects == 0
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:12509
10-12509
1462 return true;
executed: return true;
Execution Count:10
10
1463 } else if (r1->extents != r2->extents) {
evaluated: r1->extents != r2->extents
TRUEFALSE
yes
Evaluation Count:11650
yes
Evaluation Count:859
859-11650
1464 return false;
executed: return false;
Execution Count:11650
11650
1465 } else if (r1->numRects == 1 && r2->numRects == 1) {
evaluated: r1->numRects == 1
TRUEFALSE
yes
Evaluation Count:345
yes
Evaluation Count:514
partially evaluated: r2->numRects == 1
TRUEFALSE
yes
Evaluation Count:345
no
Evaluation Count:0
0-514
1466 return true;
executed: return true;
Execution Count:345
345
1467 } else { -
1468 const QRect *rr1 = (r1->numRects == 1) ? &r1->extents : r1->rects.constData();
partially evaluated: (r1->numRects == 1)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:514
0-514
1469 const QRect *rr2 = (r2->numRects == 1) ? &r2->extents : r2->rects.constData();
partially evaluated: (r2->numRects == 1)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:514
0-514
1470 for (int i = 0; i < r1->numRects; ++i, ++rr1, ++rr2) {
evaluated: i < r1->numRects
TRUEFALSE
yes
Evaluation Count:1566
yes
Evaluation Count:319
319-1566
1471 if (*rr1 != *rr2)
evaluated: *rr1 != *rr2
TRUEFALSE
yes
Evaluation Count:195
yes
Evaluation Count:1371
195-1371
1472 return false;
executed: return false;
Execution Count:195
195
1473 }
executed: }
Execution Count:1371
1371
1474 }
executed: }
Execution Count:319
319
1475 -
1476 return true;
executed: return true;
Execution Count:319
319
1477} -
1478 -
1479static bool PointInRegion(QRegionPrivate *pRegion, int x, int y) -
1480{ -
1481 int i; -
1482 -
1483 if (isEmptyHelper(pRegion))
evaluated: isEmptyHelper(pRegion)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:200047
1-200047
1484 return false;
executed: return false;
Execution Count:1
1
1485 if (!pRegion->extents.contains(x, y))
evaluated: !pRegion->extents.contains(x, y)
TRUEFALSE
yes
Evaluation Count:45120
yes
Evaluation Count:154927
45120-154927
1486 return false;
executed: return false;
Execution Count:45120
45120
1487 if (pRegion->numRects == 1)
evaluated: pRegion->numRects == 1
TRUEFALSE
yes
Evaluation Count:20
yes
Evaluation Count:154907
20-154907
1488 return pRegion->extents.contains(x, y);
executed: return pRegion->extents.contains(x, y);
Execution Count:20
20
1489 if (pRegion->innerRect.contains(x, y))
evaluated: pRegion->innerRect.contains(x, y)
TRUEFALSE
yes
Evaluation Count:19711
yes
Evaluation Count:135196
19711-135196
1490 return true;
executed: return true;
Execution Count:19711
19711
1491 for (i = 0; i < pRegion->numRects; ++i) {
evaluated: i < pRegion->numRects
TRUEFALSE
yes
Evaluation Count:4551005
yes
Evaluation Count:60214
60214-4551005
1492 if (pRegion->rects[i].contains(x, y))
evaluated: pRegion->rects[i].contains(x, y)
TRUEFALSE
yes
Evaluation Count:74982
yes
Evaluation Count:4476023
74982-4476023
1493 return true;
executed: return true;
Execution Count:74982
74982
1494 }
executed: }
Execution Count:4476023
4476023
1495 return false;
executed: return false;
Execution Count:60214
60214
1496} -
1497 -
1498static bool RectInRegion(register QRegionPrivate *region, int rx, int ry, uint rwidth, uint rheight) -
1499{ -
1500 register const QRect *pbox; -
1501 register const QRect *pboxEnd; -
1502 QRect rect(rx, ry, rwidth, rheight); -
1503 register QRect *prect = &rect; -
1504 int partIn, partOut; -
1505 -
1506 if (!region || region->numRects == 0 || !((&region->extents)->right() >= (prect)->left() && (&region->extents)->left() <= (prect)->right() && (&region->extents)->bottom() >= (prect)->top() && (&region->extents)->top() <= (prect)->bottom()))
partially evaluated: !region
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:41
partially evaluated: region->numRects == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:41
evaluated: (&region->extents)->right() >= (prect)->left()
TRUEFALSE
yes
Evaluation Count:35
yes
Evaluation Count:6
evaluated: (&region->extents)->left() <= (prect)->right()
TRUEFALSE
yes
Evaluation Count:32
yes
Evaluation Count:3
partially evaluated: (&region->extents)->bottom() >= (prect)->top()
TRUEFALSE
yes
Evaluation Count:32
no
Evaluation Count:0
partially evaluated: (&region->extents)->top() <= (prect)->bottom()
TRUEFALSE
yes
Evaluation Count:32
no
Evaluation Count:0
0-41
1507 return 0;
executed: return 0;
Execution Count:9
9
1508 -
1509 partOut = false; -
1510 partIn = false; -
1511 -
1512 -
1513 pbox = (region->numRects == 1) ? &region->extents : region->rects.constData();
evaluated: (region->numRects == 1)
TRUEFALSE
yes
Evaluation Count:21
yes
Evaluation Count:11
11-21
1514 pboxEnd = pbox + region->numRects; -
1515 for (; pbox < pboxEnd; ++pbox) {
evaluated: pbox < pboxEnd
TRUEFALSE
yes
Evaluation Count:43
yes
Evaluation Count:9
9-43
1516 if (pbox->bottom() < ry)
evaluated: pbox->bottom() < ry
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:39
4-39
1517 continue;
executed: continue;
Execution Count:4
4
1518 -
1519 if (pbox->top() > ry) {
evaluated: pbox->top() > ry
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:34
5-34
1520 partOut = true; -
1521 if (partIn || pbox->top() > prect->bottom())
evaluated: partIn
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:2
partially evaluated: pbox->top() > prect->bottom()
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-3
1522 break;
executed: break;
Execution Count:5
5
1523 ry = pbox->top(); -
1524 }
never executed: }
0
1525 -
1526 if (pbox->right() < rx)
evaluated: pbox->right() < rx
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:30
4-30
1527 continue;
executed: continue;
Execution Count:4
4
1528 -
1529 if (pbox->left() > rx) {
evaluated: pbox->left() > rx
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:28
2-28
1530 partOut = true; -
1531 if (partIn)
partially evaluated: partIn
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
1532 break;
never executed: break;
0
1533 }
executed: }
Execution Count:2
2
1534 -
1535 if (pbox->left() <= prect->right()) {
evaluated: pbox->left() <= prect->right()
TRUEFALSE
yes
Evaluation Count:28
yes
Evaluation Count:2
2-28
1536 partIn = true; -
1537 if (partOut)
partially evaluated: partOut
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:28
0-28
1538 break;
never executed: break;
0
1539 }
executed: }
Execution Count:28
28
1540 -
1541 if (pbox->right() >= prect->right()) {
partially evaluated: pbox->right() >= prect->right()
TRUEFALSE
yes
Evaluation Count:30
no
Evaluation Count:0
0-30
1542 ry = pbox->bottom() + 1; -
1543 if (ry > prect->bottom())
evaluated: ry > prect->bottom()
TRUEFALSE
yes
Evaluation Count:18
yes
Evaluation Count:12
12-18
1544 break;
executed: break;
Execution Count:18
18
1545 rx = prect->left(); -
1546 } else {
executed: }
Execution Count:12
12
1547 -
1548 -
1549 -
1550 -
1551 -
1552 -
1553 -
1554 break;
never executed: break;
0
1555 } -
1556 } -
1557 return partIn ? ((ry <= prect->bottom()) ? 2 : 1) : 0;
executed: return partIn ? ((ry <= prect->bottom()) ? 2 : 1) : 0;
Execution Count:32
32
1558} -
1559typedef struct { -
1560 int minor_axis; -
1561 int d; -
1562 int m, m1; -
1563 int incr1, incr2; -
1564} BRESINFO; -
1565typedef struct _EdgeTableEntry { -
1566 int ymax; -
1567 BRESINFO bres; -
1568 struct _EdgeTableEntry *next; -
1569 struct _EdgeTableEntry *back; -
1570 struct _EdgeTableEntry *nextWETE; -
1571 int ClockWise; -
1572} EdgeTableEntry; -
1573 -
1574 -
1575typedef struct _ScanLineList{ -
1576 int scanline; -
1577 EdgeTableEntry *edgelist; -
1578 struct _ScanLineList *next; -
1579} ScanLineList; -
1580 -
1581 -
1582typedef struct { -
1583 int ymax; -
1584 int ymin; -
1585 ScanLineList scanlines; -
1586} EdgeTable; -
1587typedef struct _ScanLineListBlock { -
1588 ScanLineList SLLs[25]; -
1589 struct _ScanLineListBlock *next; -
1590} ScanLineListBlock; -
1591static void InsertEdgeInET(EdgeTable *ET, EdgeTableEntry *ETE, int scanline, -
1592 ScanLineListBlock **SLLBlock, int *iSLLBlock) -
1593{ -
1594 register EdgeTableEntry *start, *prev; -
1595 register ScanLineList *pSLL, *pPrevSLL; -
1596 ScanLineListBlock *tmpSLLBlock; -
1597 -
1598 -
1599 -
1600 -
1601 pPrevSLL = &ET->scanlines; -
1602 pSLL = pPrevSLL->next; -
1603 while (pSLL && (pSLL->scanline < scanline)) {
evaluated: pSLL
TRUEFALSE
yes
Evaluation Count:3866
yes
Evaluation Count:181
evaluated: (pSLL->scanline < scanline)
TRUEFALSE
yes
Evaluation Count:3352
yes
Evaluation Count:514
181-3866
1604 pPrevSLL = pSLL; -
1605 pSLL = pSLL->next; -
1606 }
executed: }
Execution Count:3352
3352
1607 -
1608 -
1609 -
1610 -
1611 if ((!pSLL) || (pSLL->scanline > scanline)) {
evaluated: (!pSLL)
TRUEFALSE
yes
Evaluation Count:181
yes
Evaluation Count:514
evaluated: (pSLL->scanline > scanline)
TRUEFALSE
yes
Evaluation Count:165
yes
Evaluation Count:349
165-514
1612 if (*iSLLBlock > 25 -1)
evaluated: *iSLLBlock > 25 -1
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:338
8-338
1613 { -
1614 tmpSLLBlock = -
1615 (ScanLineListBlock *)malloc(sizeof(ScanLineListBlock)); -
1616 qt_noop(); -
1617 (*SLLBlock)->next = tmpSLLBlock; -
1618 tmpSLLBlock->next = (ScanLineListBlock *)__null; -
1619 *SLLBlock = tmpSLLBlock; -
1620 *iSLLBlock = 0; -
1621 }
executed: }
Execution Count:8
8
1622 pSLL = &((*SLLBlock)->SLLs[(*iSLLBlock)++]); -
1623 -
1624 pSLL->next = pPrevSLL->next; -
1625 pSLL->edgelist = (EdgeTableEntry *)__null; -
1626 pPrevSLL->next = pSLL; -
1627 }
executed: }
Execution Count:346
346
1628 pSLL->scanline = scanline; -
1629 -
1630 -
1631 -
1632 -
1633 prev = 0; -
1634 start = pSLL->edgelist; -
1635 while (start && (start->bres.minor_axis < ETE->bres.minor_axis)) {
evaluated: start
TRUEFALSE
yes
Evaluation Count:355
yes
Evaluation Count:509
evaluated: (start->bres.minor_axis < ETE->bres.minor_axis)
TRUEFALSE
yes
Evaluation Count:169
yes
Evaluation Count:186
169-509
1636 prev = start; -
1637 start = start->next; -
1638 }
executed: }
Execution Count:169
169
1639 ETE->next = start; -
1640 -
1641 if (prev)
evaluated: prev
TRUEFALSE
yes
Evaluation Count:163
yes
Evaluation Count:532
163-532
1642 prev->next = ETE;
executed: prev->next = ETE;
Execution Count:163
163
1643 else -
1644 pSLL->edgelist = ETE;
executed: pSLL->edgelist = ETE;
Execution Count:532
532
1645} -
1646static void CreateETandAET(register int count, register const QPoint *pts, -
1647 EdgeTable *ET, EdgeTableEntry *AET, register EdgeTableEntry *pETEs, -
1648 ScanLineListBlock *pSLLBlock) -
1649{ -
1650 register const QPoint *top, -
1651 *bottom, -
1652 *PrevPt, -
1653 *CurrPt; -
1654 int iSLLBlock = 0; -
1655 int dy; -
1656 -
1657 if (count < 2)
partially evaluated: count < 2
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:21
0-21
1658 return;
never executed: return;
0
1659 -
1660 -
1661 -
1662 -
1663 AET->next = 0; -
1664 AET->back = 0; -
1665 AET->nextWETE = 0; -
1666 AET->bres.minor_axis = (-2147483647 - 1); -
1667 -
1668 -
1669 -
1670 -
1671 ET->scanlines.next = 0; -
1672 ET->ymax = (-2147483647 - 1); -
1673 ET->ymin = 2147483647; -
1674 pSLLBlock->next = 0; -
1675 -
1676 PrevPt = &pts[count - 1]; -
1677 -
1678 -
1679 -
1680 -
1681 -
1682 -
1683 while (count--) {
evaluated: count--
TRUEFALSE
yes
Evaluation Count:750
yes
Evaluation Count:21
21-750
1684 CurrPt = pts++; -
1685 -
1686 -
1687 -
1688 -
1689 if (PrevPt->y() > CurrPt->y()) {
evaluated: PrevPt->y() > CurrPt->y()
TRUEFALSE
yes
Evaluation Count:346
yes
Evaluation Count:404
346-404
1690 bottom = PrevPt; -
1691 top = CurrPt; -
1692 pETEs->ClockWise = 0; -
1693 } else {
executed: }
Execution Count:346
346
1694 bottom = CurrPt; -
1695 top = PrevPt; -
1696 pETEs->ClockWise = 1; -
1697 }
executed: }
Execution Count:404
404
1698 -
1699 -
1700 -
1701 -
1702 if (bottom->y() != top->y()) {
evaluated: bottom->y() != top->y()
TRUEFALSE
yes
Evaluation Count:695
yes
Evaluation Count:55
55-695
1703 pETEs->ymax = bottom->y() - 1; -
1704 -
1705 -
1706 -
1707 -
1708 dy = bottom->y() - top->y(); -
1709 { int dx; if ((dy) != 0) { pETEs->bres.minor_axis = (top->x()); dx = (bottom->x()) - pETEs->bres.minor_axis; if (dx < 0) { pETEs->bres.m = dx / (dy); pETEs->bres.m1 = pETEs->bres.m - 1; pETEs->bres.incr1 = -2 * dx + 2 * (dy) * pETEs->bres.m1; pETEs->bres.incr2 = -2 * dx + 2 * (dy) * pETEs->bres.m; pETEs->bres.d = 2 * pETEs->bres.m * (dy) - 2 * dx - 2 * (dy); } else { pETEs->bres.m = dx / (dy); pETEs->bres.m1 = pETEs->bres.m + 1; pETEs->bres.incr1 = 2 * dx - 2 * (dy) * pETEs->bres.m1; pETEs->bres.incr2 = 2 * dx - 2 * (dy) * pETEs->bres.m; pETEs->bres.d = -2 * pETEs->bres.m * (dy) + 2 * dx; } } }
executed: }
Execution Count:324
executed: }
Execution Count:371
partially evaluated: (dy) != 0
TRUEFALSE
yes
Evaluation Count:695
no
Evaluation Count:0
evaluated: dx < 0
TRUEFALSE
yes
Evaluation Count:324
yes
Evaluation Count:371
0-695
1710 -
1711 InsertEdgeInET(ET, pETEs, top->y(), &pSLLBlock, &iSLLBlock); -
1712 -
1713 if (PrevPt->y() > ET->ymax)
evaluated: PrevPt->y() > ET->ymax
TRUEFALSE
yes
Evaluation Count:199
yes
Evaluation Count:496
199-496
1714 ET->ymax = PrevPt->y();
executed: ET->ymax = PrevPt->y();
Execution Count:199
199
1715 if (PrevPt->y() < ET->ymin)
evaluated: PrevPt->y() < ET->ymin
TRUEFALSE
yes
Evaluation Count:188
yes
Evaluation Count:507
188-507
1716 ET->ymin = PrevPt->y();
executed: ET->ymin = PrevPt->y();
Execution Count:188
188
1717 ++pETEs; -
1718 }
executed: }
Execution Count:695
695
1719 -
1720 PrevPt = CurrPt; -
1721 }
executed: }
Execution Count:750
750
1722}
executed: }
Execution Count:21
21
1723static void loadAET(register EdgeTableEntry *AET, register EdgeTableEntry *ETEs) -
1724{ -
1725 register EdgeTableEntry *pPrevAET; -
1726 register EdgeTableEntry *tmp; -
1727 -
1728 pPrevAET = AET; -
1729 AET = AET->next; -
1730 while (ETEs) {
evaluated: ETEs
TRUEFALSE
yes
Evaluation Count:695
yes
Evaluation Count:346
346-695
1731 while (AET && AET->bres.minor_axis < ETEs->bres.minor_axis) {
evaluated: AET
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:689
evaluated: AET->bres.minor_axis < ETEs->bres.minor_axis
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:6
2-689
1732 pPrevAET = AET; -
1733 AET = AET->next; -
1734 }
executed: }
Execution Count:2
2
1735 tmp = ETEs->next; -
1736 ETEs->next = AET; -
1737 if (AET)
evaluated: AET
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:689
6-689
1738 AET->back = ETEs;
executed: AET->back = ETEs;
Execution Count:6
6
1739 ETEs->back = pPrevAET; -
1740 pPrevAET->next = ETEs; -
1741 pPrevAET = ETEs; -
1742 -
1743 ETEs = tmp; -
1744 }
executed: }
Execution Count:695
695
1745}
executed: }
Execution Count:346
346
1746static void computeWAET(register EdgeTableEntry *AET) -
1747{ -
1748 register EdgeTableEntry *pWETE; -
1749 register int inside = 1; -
1750 register int isInside = 0; -
1751 -
1752 AET->nextWETE = 0; -
1753 pWETE = AET; -
1754 AET = AET->next; -
1755 while (AET) {
never evaluated: AET
0
1756 if (AET->ClockWise)
never evaluated: AET->ClockWise
0
1757 ++isInside;
never executed: ++isInside;
0
1758 else -
1759 --isInside;
never executed: --isInside;
0
1760 -
1761 if ((!inside && !isInside) || (inside && isInside)) {
never evaluated: !inside
never evaluated: !isInside
never evaluated: inside
never evaluated: isInside
0
1762 pWETE->nextWETE = AET; -
1763 pWETE = AET; -
1764 inside = !inside; -
1765 }
never executed: }
0
1766 AET = AET->next; -
1767 }
never executed: }
0
1768 pWETE->nextWETE = 0; -
1769}
never executed: }
0
1770static int InsertionSort(register EdgeTableEntry *AET) -
1771{ -
1772 register EdgeTableEntry *pETEchase; -
1773 register EdgeTableEntry *pETEinsert; -
1774 register EdgeTableEntry *pETEchaseBackTMP; -
1775 register int changed = 0; -
1776 -
1777 AET = AET->next; -
1778 while (AET) {
evaluated: AET
TRUEFALSE
yes
Evaluation Count:8639
yes
Evaluation Count:4477
4477-8639
1779 pETEinsert = AET; -
1780 pETEchase = AET; -
1781 while (pETEchase->back->bres.minor_axis > AET->bres.minor_axis)
evaluated: pETEchase->back->bres.minor_axis > AET->bres.minor_axis
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:8639
3-8639
1782 pETEchase = pETEchase->back;
executed: pETEchase = pETEchase->back;
Execution Count:3
3
1783 -
1784 AET = AET->next; -
1785 if (pETEchase != pETEinsert) {
evaluated: pETEchase != pETEinsert
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:8637
2-8637
1786 pETEchaseBackTMP = pETEchase->back; -
1787 pETEinsert->back->next = AET; -
1788 if (AET)
evaluated: AET
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
1
1789 AET->back = pETEinsert->back;
executed: AET->back = pETEinsert->back;
Execution Count:1
1
1790 pETEinsert->next = pETEchase; -
1791 pETEchase->back->next = pETEinsert; -
1792 pETEchase->back = pETEinsert; -
1793 pETEinsert->back = pETEchaseBackTMP; -
1794 changed = 1; -
1795 }
executed: }
Execution Count:2
2
1796 }
executed: }
Execution Count:8639
8639
1797 return changed;
executed: return changed;
Execution Count:4477
4477
1798} -
1799 -
1800 -
1801 -
1802 -
1803static void FreeStorage(register ScanLineListBlock *pSLLBlock) -
1804{ -
1805 register ScanLineListBlock *tmpSLLBlock; -
1806 -
1807 while (pSLLBlock) {
evaluated: pSLLBlock
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:21
8-21
1808 tmpSLLBlock = pSLLBlock->next; -
1809 free(pSLLBlock); -
1810 pSLLBlock = tmpSLLBlock; -
1811 }
executed: }
Execution Count:8
8
1812}
executed: }
Execution Count:21
21
1813 -
1814struct QRegionSpan { -
1815 QRegionSpan() {} -
1816 QRegionSpan(int x1_, int x2_) : x1(x1_), x2(x2_) {}
executed: }
Execution Count:4544
4544
1817 -
1818 int x1; -
1819 int x2; -
1820 int width() const { return x2 - x1; }
executed: return x2 - x1;
Execution Count:2464
2464
1821}; -
1822 -
1823template<> class QTypeInfo<QRegionSpan > { public: enum { isComplex = (((Q_PRIMITIVE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_PRIMITIVE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isLarge = (sizeof(QRegionSpan)>sizeof(void*)), isPointer = false, isDummy = (((Q_PRIMITIVE_TYPE) & Q_DUMMY_TYPE) != 0), sizeOf = sizeof(QRegionSpan) }; static inline const char *name() { return "QRegionSpan"; } }; -
1824 -
1825static inline void flushRow(const QRegionSpan *spans, int y, int numSpans, QRegionPrivate *reg, int *lastRow, int *extendTo, bool *needsExtend) -
1826{ -
1827 QRect *regRects = reg->rects.data() + *lastRow; -
1828 bool canExtend = reg->rects.size() - *lastRow == numSpans
evaluated: reg->rects.size() - *lastRow == numSpans
TRUEFALSE
yes
Evaluation Count:4349
yes
Evaluation Count:25
25-4349
1829 && !(*needsExtend && *extendTo + 1 != y)
evaluated: *needsExtend
TRUEFALSE
yes
Evaluation Count:1904
yes
Evaluation Count:2445
evaluated: *extendTo + 1 != y
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1903
1-2445
1830 && (*needsExtend || regRects[0].y() + regRects[0].height() == y);
evaluated: *needsExtend
TRUEFALSE
yes
Evaluation Count:1903
yes
Evaluation Count:2445
evaluated: regRects[0].y() + regRects[0].height() == y
TRUEFALSE
yes
Evaluation Count:2444
yes
Evaluation Count:1
1-2445
1831 -
1832 for (int i = 0; i < numSpans && canExtend; ++i) {
evaluated: i < numSpans
TRUEFALSE
yes
Evaluation Count:4541
yes
Evaluation Count:4347
evaluated: canExtend
TRUEFALSE
yes
Evaluation Count:4514
yes
Evaluation Count:27
27-4541
1833 if (regRects[i].x() != spans[i].x1 || regRects[i].right() != spans[i].x2 - 1)
evaluated: regRects[i].x() != spans[i].x1
TRUEFALSE
yes
Evaluation Count:2138
yes
Evaluation Count:2376
evaluated: regRects[i].right() != spans[i].x2 - 1
TRUEFALSE
yes
Evaluation Count:296
yes
Evaluation Count:2080
296-2376
1834 canExtend = false;
executed: canExtend = false;
Execution Count:2434
2434
1835 }
executed: }
Execution Count:4514
4514
1836 -
1837 if (canExtend) {
evaluated: canExtend
TRUEFALSE
yes
Evaluation Count:1913
yes
Evaluation Count:2461
1913-2461
1838 *extendTo = y; -
1839 *needsExtend = true; -
1840 } else {
executed: }
Execution Count:1913
1913
1841 if (*needsExtend) {
evaluated: *needsExtend
TRUEFALSE
yes
Evaluation Count:254
yes
Evaluation Count:2207
254-2207
1842 for (int i = 0; i < reg->rects.size() - *lastRow; ++i)
evaluated: i < reg->rects.size() - *lastRow
TRUEFALSE
yes
Evaluation Count:257
yes
Evaluation Count:254
254-257
1843 regRects[i].setBottom(*extendTo);
executed: regRects[i].setBottom(*extendTo);
Execution Count:257
257
1844 }
executed: }
Execution Count:254
254
1845 -
1846 *lastRow = reg->rects.size(); -
1847 reg->rects.reserve(*lastRow + numSpans); -
1848 for (int i = 0; i < numSpans; ++i)
evaluated: i < numSpans
TRUEFALSE
yes
Evaluation Count:2464
yes
Evaluation Count:2461
2461-2464
1849 reg->rects << QRect(spans[i].x1, y, spans[i].width(), 1);
executed: reg->rects << QRect(spans[i].x1, y, spans[i].width(), 1);
Execution Count:2464
2464
1850 -
1851 if (spans[0].x1 < reg->extents.left())
evaluated: spans[0].x1 < reg->extents.left()
TRUEFALSE
yes
Evaluation Count:966
yes
Evaluation Count:1495
966-1495
1852 reg->extents.setLeft(spans[0].x1);
executed: reg->extents.setLeft(spans[0].x1);
Execution Count:966
966
1853 -
1854 if (spans[numSpans-1].x2 - 1 > reg->extents.right())
evaluated: spans[numSpans-1].x2 - 1 > reg->extents.right()
TRUEFALSE
yes
Evaluation Count:1124
yes
Evaluation Count:1337
1124-1337
1855 reg->extents.setRight(spans[numSpans-1].x2 - 1);
executed: reg->extents.setRight(spans[numSpans-1].x2 - 1);
Execution Count:1124
1124
1856 -
1857 *needsExtend = false; -
1858 }
executed: }
Execution Count:2461
2461
1859} -
1860static void PtsToRegion(register int numFullPtBlocks, register int iCurPtBlock, -
1861 POINTBLOCK *FirstPtBlock, QRegionPrivate *reg) -
1862{ -
1863 int lastRow = 0; -
1864 int extendTo = 0; -
1865 bool needsExtend = false; -
1866 QVarLengthArray<QRegionSpan> row; -
1867 int rowSize = 0; -
1868 -
1869 reg->extents.setLeft(2147483647); -
1870 reg->extents.setRight((-2147483647 - 1)); -
1871 reg->innerArea = -1; -
1872 -
1873 POINTBLOCK *CurPtBlock = FirstPtBlock; -
1874 for (; numFullPtBlocks >= 0; --numFullPtBlocks) {
evaluated: numFullPtBlocks >= 0
TRUEFALSE
yes
Evaluation Count:63
yes
Evaluation Count:21
21-63
1875 -
1876 int i = 200 >> 1; -
1877 if (!numFullPtBlocks)
evaluated: !numFullPtBlocks
TRUEFALSE
yes
Evaluation Count:21
yes
Evaluation Count:42
21-42
1878 i = iCurPtBlock >> 1;
executed: i = iCurPtBlock >> 1;
Execution Count:21
21
1879 if(i) {
evaluated: i
TRUEFALSE
yes
Evaluation Count:52
yes
Evaluation Count:11
11-52
1880 row.resize(qMax(row.size(), rowSize + i)); -
1881 for (QPoint *pts = CurPtBlock->pts; i--; pts += 2) {
evaluated: i--
TRUEFALSE
yes
Evaluation Count:4667
yes
Evaluation Count:52
52-4667
1882 const int width = pts[1].x() - pts[0].x(); -
1883 if (width) {
evaluated: width
TRUEFALSE
yes
Evaluation Count:4553
yes
Evaluation Count:114
114-4553
1884 if (rowSize && row[rowSize-1].x2 == pts[0].x())
evaluated: rowSize
TRUEFALSE
yes
Evaluation Count:179
yes
Evaluation Count:4374
evaluated: row[rowSize-1].x2 == pts[0].x()
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:170
9-4374
1885 row[rowSize-1].x2 = pts[1].x();
executed: row[rowSize-1].x2 = pts[1].x();
Execution Count:9
9
1886 else -
1887 row[rowSize++] = QRegionSpan(pts[0].x(), pts[1].x());
executed: row[rowSize++] = QRegionSpan(pts[0].x(), pts[1].x());
Execution Count:4544
4544
1888 } -
1889 -
1890 if (rowSize) {
evaluated: rowSize
TRUEFALSE
yes
Evaluation Count:4553
yes
Evaluation Count:114
114-4553
1891 QPoint *next = i ? &pts[2] : (numFullPtBlocks ? CurPtBlock->next->pts : 0);
evaluated: i
TRUEFALSE
yes
Evaluation Count:4502
yes
Evaluation Count:51
51-4502
1892 -
1893 if (!next || next->y() != pts[0].y()) {
evaluated: !next
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:4543
evaluated: next->y() != pts[0].y()
TRUEFALSE
yes
Evaluation Count:4364
yes
Evaluation Count:179
10-4543
1894 flushRow(row.data(), pts[0].y(), rowSize, reg, &lastRow, &extendTo, &needsExtend); -
1895 rowSize = 0; -
1896 }
executed: }
Execution Count:4374
4374
1897 }
executed: }
Execution Count:4553
4553
1898 }
executed: }
Execution Count:4667
4667
1899 }
executed: }
Execution Count:52
52
1900 CurPtBlock = CurPtBlock->next; -
1901 }
executed: }
Execution Count:63
63
1902 -
1903 if (needsExtend) {
evaluated: needsExtend
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:16
5-16
1904 for (int i = lastRow; i < reg->rects.size(); ++i)
evaluated: i < reg->rects.size()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:5
5
1905 reg->rects[i].setBottom(extendTo);
executed: reg->rects[i].setBottom(extendTo);
Execution Count:5
5
1906 }
executed: }
Execution Count:5
5
1907 -
1908 reg->numRects = reg->rects.size(); -
1909 -
1910 if (reg->numRects) {
partially evaluated: reg->numRects
TRUEFALSE
yes
Evaluation Count:21
no
Evaluation Count:0
0-21
1911 reg->extents.setTop(reg->rects[0].top()); -
1912 reg->extents.setBottom(reg->rects[lastRow].bottom()); -
1913 -
1914 for (int i = 0; i < reg->rects.size(); ++i)
evaluated: i < reg->rects.size()
TRUEFALSE
yes
Evaluation Count:2464
yes
Evaluation Count:21
21-2464
1915 reg->updateInnerRect(reg->rects[i]);
executed: reg->updateInnerRect(reg->rects[i]);
Execution Count:2464
2464
1916 } else {
executed: }
Execution Count:21
21
1917 reg->extents.setCoords(0, 0, 0, 0); -
1918 }
never executed: }
0
1919} -
1920static QRegionPrivate *PolygonRegion(const QPoint *Pts, int Count, int rule) -
1921 -
1922 -
1923 -
1924{ -
1925 QRegionPrivate *region; -
1926 register EdgeTableEntry *pAET; -
1927 register int y; -
1928 register int iPts = 0; -
1929 register EdgeTableEntry *pWETE; -
1930 register ScanLineList *pSLL; -
1931 register QPoint *pts; -
1932 EdgeTableEntry *pPrevAET; -
1933 EdgeTable ET; -
1934 EdgeTableEntry AET; -
1935 EdgeTableEntry *pETEs; -
1936 ScanLineListBlock SLLBlock; -
1937 int fixWAET = false; -
1938 POINTBLOCK FirstPtBlock, *curPtBlock; -
1939 FirstPtBlock.pts = reinterpret_cast<QPoint *>(FirstPtBlock.data); -
1940 POINTBLOCK *tmpPtBlock; -
1941 int numFullPtBlocks = 0; -
1942 -
1943 if (!(region = new QRegionPrivate))
partially evaluated: !(region = new QRegionPrivate)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:27
0-27
1944 return 0;
never executed: return 0;
0
1945 -
1946 -
1947 if (((Count == 4) ||
evaluated: (Count == 4)
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:25
2-25
1948 ((Count == 5) && (Pts[4].x() == Pts[0].x()) && (Pts[4].y() == Pts[0].y())))
evaluated: (Count == 5)
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:18
partially evaluated: (Pts[4].x() == Pts[0].x())
TRUEFALSE
yes
Evaluation Count:7
no
Evaluation Count:0
partially evaluated: (Pts[4].y() == Pts[0].y())
TRUEFALSE
yes
Evaluation Count:7
no
Evaluation Count:0
0-18
1949 && (((Pts[0].y() == Pts[1].y()) && (Pts[1].x() == Pts[2].x()) && (Pts[2].y() == Pts[3].y())
evaluated: (Pts[0].y() == Pts[1].y())
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:8
partially evaluated: (Pts[1].x() == Pts[2].x())
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
partially evaluated: (Pts[2].y() == Pts[3].y())
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-8
1950 && (Pts[3].x() == Pts[0].x())) || ((Pts[0].x() == Pts[1].x())
partially evaluated: (Pts[3].x() == Pts[0].x())
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
evaluated: (Pts[0].x() == Pts[1].x())
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:3
0-5
1951 && (Pts[1].y() == Pts[2].y()) && (Pts[2].x() == Pts[3].x())
partially evaluated: (Pts[1].y() == Pts[2].y())
TRUEFALSE
yes
Evaluation Count:5
no
Evaluation Count:0
partially evaluated: (Pts[2].x() == Pts[3].x())
TRUEFALSE
yes
Evaluation Count:5
no
Evaluation Count:0
0-5
1952 && (Pts[3].y() == Pts[0].y())))) {
partially evaluated: (Pts[3].y() == Pts[0].y())
TRUEFALSE
yes
Evaluation Count:5
no
Evaluation Count:0
0-5
1953 int x = qMin(Pts[0].x(), Pts[2].x()); -
1954 region->extents.setLeft(x); -
1955 int y = qMin(Pts[0].y(), Pts[2].y()); -
1956 region->extents.setTop(y); -
1957 region->extents.setWidth(qMax(Pts[0].x(), Pts[2].x()) - x); -
1958 region->extents.setHeight(qMax(Pts[0].y(), Pts[2].y()) - y); -
1959 if ((region->extents.left() <= region->extents.right()) &&
partially evaluated: (region->extents.left() <= region->extents.right())
TRUEFALSE
yes
Evaluation Count:6
no
Evaluation Count:0
0-6
1960 (region->extents.top() <= region->extents.bottom())) {
partially evaluated: (region->extents.top() <= region->extents.bottom())
TRUEFALSE
yes
Evaluation Count:6
no
Evaluation Count:0
0-6
1961 region->numRects = 1; -
1962 region->innerRect = region->extents; -
1963 region->innerArea = region->innerRect.width() * region->innerRect.height(); -
1964 }
executed: }
Execution Count:6
6
1965 return region;
executed: return region;
Execution Count:6
6
1966 } -
1967 -
1968 if (!(pETEs = static_cast<EdgeTableEntry *>(malloc(sizeof(EdgeTableEntry) * Count))))
partially evaluated: !(pETEs = static_cast<EdgeTableEntry *>(malloc(sizeof(EdgeTableEntry) * Count)))
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:21
0-21
1969 return 0;
never executed: return 0;
0
1970 -
1971 region->vectorize(); -
1972 -
1973 pts = FirstPtBlock.pts; -
1974 CreateETandAET(Count, Pts, &ET, &AET, pETEs, &SLLBlock); -
1975 -
1976 pSLL = ET.scanlines.next; -
1977 curPtBlock = &FirstPtBlock; -
1978 -
1979 -
1980 if (ET.ymax - ET.ymin > 100000) {
partially evaluated: ET.ymax - ET.ymin > 100000
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:21
0-21
1981 -
1982 -
1983 -
1984 -
1985 delete region; -
1986 return 0;
never executed: return 0;
0
1987 } -
1988 -
1989 -
1990 if (true) {
partially evaluated: true
TRUEFALSE
yes
Evaluation Count:21
no
Evaluation Count:0
0-21
1991 if (rule == 0) {
partially evaluated: rule == 0
TRUEFALSE
yes
Evaluation Count:21
no
Evaluation Count:0
0-21
1992 -
1993 -
1994 -
1995 for (y = ET.ymin; y < ET.ymax; ++y) {
evaluated: y < ET.ymax
TRUEFALSE
yes
Evaluation Count:4477
yes
Evaluation Count:21
21-4477
1996 -
1997 -
1998 -
1999 -
2000 -
2001 if (pSLL && y == pSLL->scanline) {
evaluated: pSLL
TRUEFALSE
yes
Evaluation Count:2660
yes
Evaluation Count:1817
evaluated: y == pSLL->scanline
TRUEFALSE
yes
Evaluation Count:346
yes
Evaluation Count:2314
346-2660
2002 loadAET(&AET, pSLL->edgelist); -
2003 pSLL = pSLL->next; -
2004 }
executed: }
Execution Count:346
346
2005 pPrevAET = &AET; -
2006 pAET = AET.next; -
2007 -
2008 -
2009 -
2010 -
2011 while (pAET) {
evaluated: pAET
TRUEFALSE
yes
Evaluation Count:9334
yes
Evaluation Count:4477
4477-9334
2012 pts->setX(pAET->bres.minor_axis); -
2013 pts->setY(y); -
2014 ++pts; -
2015 ++iPts; -
2016 -
2017 -
2018 -
2019 -
2020 if (iPts == 200) {
evaluated: iPts == 200
TRUEFALSE
yes
Evaluation Count:42
yes
Evaluation Count:9292
42-9292
2021 tmpPtBlock = (POINTBLOCK *)malloc(sizeof(POINTBLOCK)); -
2022 qt_noop(); -
2023 tmpPtBlock->pts = reinterpret_cast<QPoint *>(tmpPtBlock->data); -
2024 curPtBlock->next = tmpPtBlock; -
2025 curPtBlock = tmpPtBlock; -
2026 pts = curPtBlock->pts; -
2027 ++numFullPtBlocks; -
2028 iPts = 0; -
2029 }
executed: }
Execution Count:42
42
2030 { if (pAET->ymax == y) { pPrevAET->next = pAET->next; pAET = pPrevAET->next; if (pAET) pAET->back = pPrevAET; } else { { if (pAET->bres.m1 > 0) { if (pAET->bres.d > 0) { pAET->bres.minor_axis += pAET->bres.m1; pAET->bres.d += pAET->bres.incr1; } else { pAET->bres.minor_axis += pAET->bres.m; pAET->bres.d += pAET->bres.incr2; } } else { if (pAET->bres.d >= 0) { pAET->bres.minor_axis += pAET->bres.m1; pAET->bres.d += pAET->bres.incr1; } else { pAET->bres.minor_axis += pAET->bres.m; pAET->bres.d += pAET->bres.incr2; } } } pPrevAET = pAET; pAET = pAET->next; } }
executed: pAET->back = pPrevAET;
Execution Count:353
executed: }
Execution Count:695
executed: }
Execution Count:1204
executed: }
Execution Count:5157
executed: }
Execution Count:500
executed: }
Execution Count:1778
executed: }
Execution Count:8639
evaluated: pAET
TRUEFALSE
yes
Evaluation Count:353
yes
Evaluation Count:342
evaluated: pAET->ymax == y
TRUEFALSE
yes
Evaluation Count:695
yes
Evaluation Count:8639
evaluated: pAET->bres.m1 > 0
TRUEFALSE
yes
Evaluation Count:6361
yes
Evaluation Count:2278
evaluated: pAET->bres.d > 0
TRUEFALSE
yes
Evaluation Count:1204
yes
Evaluation Count:5157
evaluated: pAET->bres.d >= 0
TRUEFALSE
yes
Evaluation Count:500
yes
Evaluation Count:1778
342-8639
2031 } -
2032 InsertionSort(&AET); -
2033 }
executed: }
Execution Count:4477
4477
2034 } else {
executed: }
Execution Count:21
21
2035 -
2036 -
2037 -
2038 for (y = ET.ymin; y < ET.ymax; ++y) {
never evaluated: y < ET.ymax
0
2039 -
2040 -
2041 -
2042 -
2043 if (pSLL && y == pSLL->scanline) {
never evaluated: pSLL
never evaluated: y == pSLL->scanline
0
2044 loadAET(&AET, pSLL->edgelist); -
2045 computeWAET(&AET); -
2046 pSLL = pSLL->next; -
2047 }
never executed: }
0
2048 pPrevAET = &AET; -
2049 pAET = AET.next; -
2050 pWETE = pAET; -
2051 -
2052 -
2053 -
2054 -
2055 while (pAET) {
never evaluated: pAET
0
2056 -
2057 -
2058 -
2059 -
2060 if (pWETE == pAET) {
never evaluated: pWETE == pAET
0
2061 pts->setX(pAET->bres.minor_axis); -
2062 pts->setY(y); -
2063 ++pts; -
2064 ++iPts; -
2065 -
2066 -
2067 -
2068 -
2069 if (iPts == 200) {
never evaluated: iPts == 200
0
2070 tmpPtBlock = static_cast<POINTBLOCK *>(malloc(sizeof(POINTBLOCK))); -
2071 tmpPtBlock->pts = reinterpret_cast<QPoint *>(tmpPtBlock->data); -
2072 curPtBlock->next = tmpPtBlock; -
2073 curPtBlock = tmpPtBlock; -
2074 pts = curPtBlock->pts; -
2075 ++numFullPtBlocks; -
2076 iPts = 0; -
2077 }
never executed: }
0
2078 pWETE = pWETE->nextWETE; -
2079 }
never executed: }
0
2080 { if (pAET->ymax == y) { pPrevAET->next = pAET->next; pAET = pPrevAET->next; fixWAET = 1; if (pAET) pAET->back = pPrevAET; } else { { if (pAET->bres.m1 > 0) { if (pAET->bres.d > 0) { pAET->bres.minor_axis += pAET->bres.m1; pAET->bres.d += pAET->bres.incr1; } else { pAET->bres.minor_axis += pAET->bres.m; pAET->bres.d += pAET->bres.incr2; } } else { if (pAET->bres.d >= 0) { pAET->bres.minor_axis += pAET->bres.m1; pAET->bres.d += pAET->bres.incr1; } else { pAET->bres.minor_axis += pAET->bres.m; pAET->bres.d += pAET->bres.incr2; } } } pPrevAET = pAET; pAET = pAET->next; } }
never executed: pAET->back = pPrevAET;
never executed: }
never executed: }
never executed: }
never executed: }
never executed: }
never executed: }
never evaluated: pAET
never evaluated: pAET->ymax == y
never evaluated: pAET->bres.m1 > 0
never evaluated: pAET->bres.d > 0
never evaluated: pAET->bres.d >= 0
0
2081 } -
2082 -
2083 -
2084 -
2085 -
2086 -
2087 if (InsertionSort(&AET) || fixWAET) {
never evaluated: InsertionSort(&AET)
never evaluated: fixWAET
0
2088 computeWAET(&AET); -
2089 fixWAET = false; -
2090 }
never executed: }
0
2091 }
never executed: }
0
2092 }
never executed: }
0
2093 } else { -
2094 FreeStorage(SLLBlock.next); -
2095 PtsToRegion(numFullPtBlocks, iPts, &FirstPtBlock, region); -
2096 for (curPtBlock = FirstPtBlock.next; --numFullPtBlocks >= 0;) {
never evaluated: --numFullPtBlocks >= 0
0
2097 tmpPtBlock = curPtBlock->next; -
2098 free(curPtBlock); -
2099 curPtBlock = tmpPtBlock; -
2100 }
never executed: }
0
2101 free(pETEs); -
2102 return 0;
never executed: return 0;
0
2103 } -
2104 -
2105 FreeStorage(SLLBlock.next); -
2106 PtsToRegion(numFullPtBlocks, iPts, &FirstPtBlock, region); -
2107 for (curPtBlock = FirstPtBlock.next; --numFullPtBlocks >= 0;) {
evaluated: --numFullPtBlocks >= 0
TRUEFALSE
yes
Evaluation Count:42
yes
Evaluation Count:21
21-42
2108 tmpPtBlock = curPtBlock->next; -
2109 free(curPtBlock); -
2110 curPtBlock = tmpPtBlock; -
2111 }
executed: }
Execution Count:42
42
2112 free(pETEs); -
2113 return region;
executed: return region;
Execution Count:21
21
2114} -
2115 -
2116 -
2117QRegionPrivate *qt_bitmapToRegion(const QBitmap& bitmap) -
2118{ -
2119 QImage image = bitmap.toImage(); -
2120 -
2121 QRegionPrivate *region = new QRegionPrivate; -
2122 -
2123 QRect xr; -
2124 -
2125 -
2126 -
2127 -
2128 -
2129 -
2130 -
2131 const uchar zero = 0; -
2132 bool little = image.format() == QImage::Format_MonoLSB; -
2133 -
2134 int x, -
2135 y; -
2136 for (y = 0; y < image.height(); ++y) {
evaluated: y < image.height()
TRUEFALSE
yes
Evaluation Count:315
yes
Evaluation Count:5
5-315
2137 uchar *line = image.scanLine(y); -
2138 int w = image.width(); -
2139 uchar all = zero; -
2140 int prev1 = -1; -
2141 for (x = 0; x < w;) {
evaluated: x < w
TRUEFALSE
yes
Evaluation Count:4485
yes
Evaluation Count:315
315-4485
2142 uchar byte = line[x / 8]; -
2143 if (x > w - 8 || byte!=all) {
evaluated: x > w - 8
TRUEFALSE
yes
Evaluation Count:315
yes
Evaluation Count:4170
evaluated: byte!=all
TRUEFALSE
yes
Evaluation Count:391
yes
Evaluation Count:3779
315-4170
2144 if (little) {
partially evaluated: little
TRUEFALSE
yes
Evaluation Count:706
no
Evaluation Count:0
0-706
2145 for (int b = 8; b > 0 && x < w; --b) {
evaluated: b > 0
TRUEFALSE
yes
Evaluation Count:4113
yes
Evaluation Count:391
evaluated: x < w
TRUEFALSE
yes
Evaluation Count:3798
yes
Evaluation Count:315
315-4113
2146 if (!(byte & 0x01) == !all) {
evaluated: !(byte & 0x01) == !all
TRUEFALSE
yes
Evaluation Count:3337
yes
Evaluation Count:461
461-3337
2147 -
2148 } else {
executed: }
Execution Count:3337
3337
2149 -
2150 if (all!=zero) {
evaluated: all!=zero
TRUEFALSE
yes
Evaluation Count:146
yes
Evaluation Count:315
146-315
2151 { xr.setCoords(prev1, y, x-1, y); UnionRectWithRegion(&xr, region, *region); } -
2152 all = zero; -
2153 } else {
executed: }
Execution Count:146
146
2154 prev1 = x; -
2155 all = ~zero; -
2156 }
executed: }
Execution Count:315
315
2157 } -
2158 byte >>= 1; -
2159 ++x; -
2160 }
executed: }
Execution Count:3798
3798
2161 } else {
executed: }
Execution Count:706
706
2162 for (int b = 8; b > 0 && x < w; --b) {
never evaluated: b > 0
never evaluated: x < w
0
2163 if (!(byte & 0x80) == !all) {
never evaluated: !(byte & 0x80) == !all
0
2164 -
2165 } else {
never executed: }
0
2166 -
2167 if (all != zero) {
never evaluated: all != zero
0
2168 { xr.setCoords(prev1, y, x-1, y); UnionRectWithRegion(&xr, region, *region); } -
2169 all = zero; -
2170 } else {
never executed: }
0
2171 prev1 = x; -
2172 all = ~zero; -
2173 }
never executed: }
0
2174 } -
2175 byte <<= 1; -
2176 ++x; -
2177 }
never executed: }
0
2178 }
never executed: }
0
2179 } else { -
2180 x += 8; -
2181 }
executed: }
Execution Count:3779
3779
2182 } -
2183 if (all != zero) {
evaluated: all != zero
TRUEFALSE
yes
Evaluation Count:169
yes
Evaluation Count:146
146-169
2184 { xr.setCoords(prev1, y, x-1, y); UnionRectWithRegion(&xr, region, *region); } -
2185 }
executed: }
Execution Count:169
169
2186 }
executed: }
Execution Count:315
315
2187 -
2188 -
2189 return region;
executed: return region;
Execution Count:5
5
2190} -
2191 -
2192QRegion::QRegion() -
2193 : d(&shared_empty) -
2194{ -
2195 d->ref.ref(); -
2196}
executed: }
Execution Count:499990
499990
2197 -
2198QRegion::QRegion(const QRect &r, RegionType t) -
2199{ -
2200 if (r.isEmpty()) {
evaluated: r.isEmpty()
TRUEFALSE
yes
Evaluation Count:8172
yes
Evaluation Count:139839
8172-139839
2201 d = &shared_empty; -
2202 d->ref.ref(); -
2203 } else {
executed: }
Execution Count:8172
8172
2204 d = new QRegionData; -
2205 d->ref.store(1); -
2206 if (t == Rectangle) {
evaluated: t == Rectangle
TRUEFALSE
yes
Evaluation Count:139827
yes
Evaluation Count:12
12-139827
2207 d->qt_rgn = new QRegionPrivate(r); -
2208 } else if (t == Ellipse) {
executed: }
Execution Count:139827
partially evaluated: t == Ellipse
TRUEFALSE
yes
Evaluation Count:12
no
Evaluation Count:0
0-139827
2209 QPainterPath path; -
2210 path.addEllipse(r.x(), r.y(), r.width(), r.height()); -
2211 QPolygon a = path.toSubpathPolygons().at(0).toPolygon(); -
2212 d->qt_rgn = PolygonRegion(a.constData(), a.size(), 0); -
2213 }
executed: }
Execution Count:12
12
2214 } -
2215} -
2216 -
2217QRegion::QRegion(const QPolygon &a, Qt::FillRule fillRule) -
2218{ -
2219 if (a.count() > 2) {
evaluated: a.count() > 2
TRUEFALSE
yes
Evaluation Count:15
yes
Evaluation Count:6
6-15
2220 QRegionPrivate *qt_rgn = PolygonRegion(a.constData(), a.size(), -
2221 fillRule == Qt::WindingFill ? 1 : 0); -
2222 if (qt_rgn) {
partially evaluated: qt_rgn
TRUEFALSE
yes
Evaluation Count:15
no
Evaluation Count:0
0-15
2223 d = new QRegionData; -
2224 d->ref.store(1); -
2225 d->qt_rgn = qt_rgn; -
2226 } else {
executed: }
Execution Count:15
15
2227 d = &shared_empty; -
2228 d->ref.ref(); -
2229 }
never executed: }
0
2230 } else { -
2231 d = &shared_empty; -
2232 d->ref.ref(); -
2233 }
executed: }
Execution Count:6
6
2234} -
2235 -
2236QRegion::QRegion(const QRegion &r) -
2237{ -
2238 d = r.d; -
2239 d->ref.ref(); -
2240}
executed: }
Execution Count:372035
372035
2241 -
2242 -
2243QRegion::QRegion(const QBitmap &bm) -
2244{ -
2245 if (bm.isNull()) {
evaluated: bm.isNull()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:5
1-5
2246 d = &shared_empty; -
2247 d->ref.ref(); -
2248 } else {
executed: }
Execution Count:1
1
2249 d = new QRegionData; -
2250 d->ref.store(1); -
2251 d->qt_rgn = qt_bitmapToRegion(bm); -
2252 }
executed: }
Execution Count:5
5
2253} -
2254 -
2255void QRegion::cleanUp(QRegion::QRegionData *x) -
2256{ -
2257 delete x->qt_rgn; -
2258 delete x; -
2259}
executed: }
Execution Count:204421
204421
2260 -
2261QRegion::~QRegion() -
2262{ -
2263 if (!d->ref.deref())
evaluated: !d->ref.deref()
TRUEFALSE
yes
Evaluation Count:172111
yes
Evaluation Count:853049
172111-853049
2264 cleanUp(d);
executed: cleanUp(d);
Execution Count:172111
172111
2265}
executed: }
Execution Count:1025160
1025160
2266 -
2267 -
2268QRegion &QRegion::operator=(const QRegion &r) -
2269{ -
2270 r.d->ref.ref(); -
2271 if (!d->ref.deref())
evaluated: !d->ref.deref()
TRUEFALSE
yes
Evaluation Count:32310
yes
Evaluation Count:127335
32310-127335
2272 cleanUp(d);
executed: cleanUp(d);
Execution Count:32310
32310
2273 d = r.d; -
2274 return *this;
executed: return *this;
Execution Count:159645
159645
2275} -
2276 -
2277 -
2278 -
2279 -
2280 -
2281QRegion QRegion::copy() const -
2282{ -
2283 QRegion r; -
2284 QScopedPointer<QRegionData> x(new QRegionData); -
2285 x->ref.store(1); -
2286 if (d->qt_rgn)
partially evaluated: d->qt_rgn
TRUEFALSE
yes
Evaluation Count:64594
no
Evaluation Count:0
0-64594
2287 x->qt_rgn = new QRegionPrivate(*d->qt_rgn);
executed: x->qt_rgn = new QRegionPrivate(*d->qt_rgn);
Execution Count:64594
64594
2288 else -
2289 x->qt_rgn = new QRegionPrivate;
never executed: x->qt_rgn = new QRegionPrivate;
0
2290 if (!r.d->ref.deref())
partially evaluated: !r.d->ref.deref()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:64594
0-64594
2291 cleanUp(r.d);
never executed: cleanUp(r.d);
0
2292 r.d = x.take(); -
2293 return r;
executed: return r;
Execution Count:64594
64594
2294} -
2295 -
2296bool QRegion::isEmpty() const -
2297{ -
2298 return d == &shared_empty || d->qt_rgn->numRects == 0;
executed: return d == &shared_empty || d->qt_rgn->numRects == 0;
Execution Count:310727
310727
2299} -
2300 -
2301bool QRegion::isNull() const -
2302{ -
2303 return d == &shared_empty || d->qt_rgn->numRects == 0;
executed: return d == &shared_empty || d->qt_rgn->numRects == 0;
Execution Count:3369
3369
2304} -
2305 -
2306bool QRegion::contains(const QPoint &p) const -
2307{ -
2308 return PointInRegion(d->qt_rgn, p.x(), p.y());
executed: return PointInRegion(d->qt_rgn, p.x(), p.y());
Execution Count:200048
200048
2309} -
2310 -
2311bool QRegion::contains(const QRect &r) const -
2312{ -
2313 return RectInRegion(d->qt_rgn, r.left(), r.top(), r.width(), r.height()) != 0;
executed: return RectInRegion(d->qt_rgn, r.left(), r.top(), r.width(), r.height()) != 0;
Execution Count:41
41
2314} -
2315 -
2316 -
2317 -
2318void QRegion::translate(int dx, int dy) -
2319{ -
2320 if ((dx == 0 && dy == 0) || isEmptyHelper(d->qt_rgn))
evaluated: dx == 0
TRUEFALSE
yes
Evaluation Count:15945
yes
Evaluation Count:52449
evaluated: dy == 0
TRUEFALSE
yes
Evaluation Count:12033
yes
Evaluation Count:3912
evaluated: isEmptyHelper(d->qt_rgn)
TRUEFALSE
yes
Evaluation Count:5236
yes
Evaluation Count:51125
3912-52449
2321 return;
executed: return;
Execution Count:17269
17269
2322 -
2323 detach(); -
2324 OffsetRegion(*d->qt_rgn, dx, dy); -
2325}
executed: }
Execution Count:51125
51125
2326 -
2327QRegion QRegion::united(const QRegion &r) const -
2328{ -
2329 if (isEmptyHelper(d->qt_rgn))
evaluated: isEmptyHelper(d->qt_rgn)
TRUEFALSE
yes
Evaluation Count:7375
yes
Evaluation Count:12395
7375-12395
2330 return r;
executed: return r;
Execution Count:7375
7375
2331 if (isEmptyHelper(r.d->qt_rgn))
evaluated: isEmptyHelper(r.d->qt_rgn)
TRUEFALSE
yes
Evaluation Count:688
yes
Evaluation Count:11707
688-11707
2332 return *this;
executed: return *this;
Execution Count:688
688
2333 if (d == r.d)
evaluated: d == r.d
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:11703
4-11703
2334 return *this;
executed: return *this;
Execution Count:4
4
2335 -
2336 if (d->qt_rgn->contains(*r.d->qt_rgn)) {
evaluated: d->qt_rgn->contains(*r.d->qt_rgn)
TRUEFALSE
yes
Evaluation Count:2477
yes
Evaluation Count:9226
2477-9226
2337 return *this;
executed: return *this;
Execution Count:2477
2477
2338 } else if (r.d->qt_rgn->contains(*d->qt_rgn)) {
evaluated: r.d->qt_rgn->contains(*d->qt_rgn)
TRUEFALSE
yes
Evaluation Count:86
yes
Evaluation Count:9140
86-9140
2339 return r;
executed: return r;
Execution Count:86
86
2340 } else if (d->qt_rgn->canAppend(r.d->qt_rgn)) {
evaluated: d->qt_rgn->canAppend(r.d->qt_rgn)
TRUEFALSE
yes
Evaluation Count:7006
yes
Evaluation Count:2134
2134-7006
2341 QRegion result(*this); -
2342 result.detach(); -
2343 result.d->qt_rgn->append(r.d->qt_rgn); -
2344 return result;
executed: return result;
Execution Count:7006
7006
2345 } else if (d->qt_rgn->canPrepend(r.d->qt_rgn)) {
evaluated: d->qt_rgn->canPrepend(r.d->qt_rgn)
TRUEFALSE
yes
Evaluation Count:1870
yes
Evaluation Count:264
264-1870
2346 QRegion result(*this); -
2347 result.detach(); -
2348 result.d->qt_rgn->prepend(r.d->qt_rgn); -
2349 return result;
executed: return result;
Execution Count:1870
1870
2350 } else if (EqualRegion(d->qt_rgn, r.d->qt_rgn)) {
partially evaluated: EqualRegion(d->qt_rgn, r.d->qt_rgn)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:264
0-264
2351 return *this;
never executed: return *this;
0
2352 } else { -
2353 QRegion result; -
2354 result.detach(); -
2355 UnionRegion(d->qt_rgn, r.d->qt_rgn, *result.d->qt_rgn); -
2356 return result;
executed: return result;
Execution Count:264
264
2357 } -
2358} -
2359 -
2360QRegion& QRegion::operator+=(const QRegion &r) -
2361{ -
2362 if (isEmptyHelper(d->qt_rgn))
evaluated: isEmptyHelper(d->qt_rgn)
TRUEFALSE
yes
Evaluation Count:15939
yes
Evaluation Count:26096
15939-26096
2363 return *this = r;
executed: return *this = r;
Execution Count:15939
15939
2364 if (isEmptyHelper(r.d->qt_rgn))
evaluated: isEmptyHelper(r.d->qt_rgn)
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:26094
2-26094
2365 return *this;
executed: return *this;
Execution Count:2
2
2366 if (d == r.d)
evaluated: d == r.d
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:26082
12-26082
2367 return *this;
executed: return *this;
Execution Count:12
12
2368 -
2369 if (d->qt_rgn->contains(*r.d->qt_rgn)) {
evaluated: d->qt_rgn->contains(*r.d->qt_rgn)
TRUEFALSE
yes
Evaluation Count:6685
yes
Evaluation Count:19397
6685-19397
2370 return *this;
executed: return *this;
Execution Count:6685
6685
2371 } else if (r.d->qt_rgn->contains(*d->qt_rgn)) {
evaluated: r.d->qt_rgn->contains(*d->qt_rgn)
TRUEFALSE
yes
Evaluation Count:625
yes
Evaluation Count:18772
625-18772
2372 return *this = r;
executed: return *this = r;
Execution Count:625
625
2373 } else if (d->qt_rgn->canAppend(r.d->qt_rgn)) {
evaluated: d->qt_rgn->canAppend(r.d->qt_rgn)
TRUEFALSE
yes
Evaluation Count:2336
yes
Evaluation Count:16436
2336-16436
2374 detach(); -
2375 d->qt_rgn->append(r.d->qt_rgn); -
2376 return *this;
executed: return *this;
Execution Count:2336
2336
2377 } else if (d->qt_rgn->canPrepend(r.d->qt_rgn)) {
evaluated: d->qt_rgn->canPrepend(r.d->qt_rgn)
TRUEFALSE
yes
Evaluation Count:2613
yes
Evaluation Count:13823
2613-13823
2378 detach(); -
2379 d->qt_rgn->prepend(r.d->qt_rgn); -
2380 return *this;
executed: return *this;
Execution Count:2613
2613
2381 } else if (EqualRegion(d->qt_rgn, r.d->qt_rgn)) {
evaluated: EqualRegion(d->qt_rgn, r.d->qt_rgn)
TRUEFALSE
yes
Evaluation Count:214
yes
Evaluation Count:13609
214-13609
2382 return *this;
executed: return *this;
Execution Count:214
214
2383 } else { -
2384 detach(); -
2385 UnionRegion(d->qt_rgn, r.d->qt_rgn, *d->qt_rgn); -
2386 return *this;
executed: return *this;
Execution Count:13609
13609
2387 } -
2388} -
2389 -
2390QRegion QRegion::united(const QRect &r) const -
2391{ -
2392 if (isEmptyHelper(d->qt_rgn))
evaluated: isEmptyHelper(d->qt_rgn)
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:31
3-31
2393 return r;
executed: return r;
Execution Count:3
3
2394 if (r.isEmpty())
evaluated: r.isEmpty()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:30
1-30
2395 return *this;
executed: return *this;
Execution Count:1
1
2396 -
2397 if (d->qt_rgn->contains(r)) {
evaluated: d->qt_rgn->contains(r)
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:26
4-26
2398 return *this;
executed: return *this;
Execution Count:4
4
2399 } else if (d->qt_rgn->within(r)) {
partially evaluated: d->qt_rgn->within(r)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:26
0-26
2400 return r;
never executed: return r;
0
2401 } else if (d->qt_rgn->numRects == 1 && d->qt_rgn->extents == r) {
evaluated: d->qt_rgn->numRects == 1
TRUEFALSE
yes
Evaluation Count:20
yes
Evaluation Count:6
partially evaluated: d->qt_rgn->extents == r
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:20
0-20
2402 return *this;
never executed: return *this;
0
2403 } else if (d->qt_rgn->canAppend(&r)) {
evaluated: d->qt_rgn->canAppend(&r)
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:13
13
2404 QRegion result(*this); -
2405 result.detach(); -
2406 result.d->qt_rgn->append(&r); -
2407 return result;
executed: return result;
Execution Count:13
13
2408 } else if (d->qt_rgn->canPrepend(&r)) {
evaluated: d->qt_rgn->canPrepend(&r)
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:8
5-8
2409 QRegion result(*this); -
2410 result.detach(); -
2411 result.d->qt_rgn->prepend(&r); -
2412 return result;
executed: return result;
Execution Count:5
5
2413 } else { -
2414 QRegion result; -
2415 result.detach(); -
2416 QRegionPrivate rp(r); -
2417 UnionRegion(d->qt_rgn, &rp, *result.d->qt_rgn); -
2418 return result;
executed: return result;
Execution Count:8
8
2419 } -
2420} -
2421 -
2422QRegion& QRegion::operator+=(const QRect &r) -
2423{ -
2424 if (isEmptyHelper(d->qt_rgn))
evaluated: isEmptyHelper(d->qt_rgn)
TRUEFALSE
yes
Evaluation Count:8183
yes
Evaluation Count:11051
8183-11051
2425 return *this = r;
executed: return *this = r;
Execution Count:8183
8183
2426 if (r.isEmpty())
partially evaluated: r.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:11051
0-11051
2427 return *this;
never executed: return *this;
0
2428 -
2429 if (d->qt_rgn->contains(r)) {
evaluated: d->qt_rgn->contains(r)
TRUEFALSE
yes
Evaluation Count:426
yes
Evaluation Count:10625
426-10625
2430 return *this;
executed: return *this;
Execution Count:426
426
2431 } else if (d->qt_rgn->within(r)) {
evaluated: d->qt_rgn->within(r)
TRUEFALSE
yes
Evaluation Count:1846
yes
Evaluation Count:8779
1846-8779
2432 return *this = r;
executed: return *this = r;
Execution Count:1846
1846
2433 } else if (d->qt_rgn->canAppend(&r)) {
evaluated: d->qt_rgn->canAppend(&r)
TRUEFALSE
yes
Evaluation Count:2216
yes
Evaluation Count:6563
2216-6563
2434 detach(); -
2435 d->qt_rgn->append(&r); -
2436 return *this;
executed: return *this;
Execution Count:2216
2216
2437 } else if (d->qt_rgn->canPrepend(&r)) {
evaluated: d->qt_rgn->canPrepend(&r)
TRUEFALSE
yes
Evaluation Count:583
yes
Evaluation Count:5980
583-5980
2438 detach(); -
2439 d->qt_rgn->prepend(&r); -
2440 return *this;
executed: return *this;
Execution Count:583
583
2441 } else if (d->qt_rgn->numRects == 1 && d->qt_rgn->extents == r) {
evaluated: d->qt_rgn->numRects == 1
TRUEFALSE
yes
Evaluation Count:821
yes
Evaluation Count:5159
partially evaluated: d->qt_rgn->extents == r
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:821
0-5159
2442 return *this;
never executed: return *this;
0
2443 } else { -
2444 detach(); -
2445 QRegionPrivate p(r); -
2446 UnionRegion(d->qt_rgn, &p, *d->qt_rgn); -
2447 return *this;
executed: return *this;
Execution Count:5980
5980
2448 } -
2449} -
2450 -
2451QRegion QRegion::intersected(const QRegion &r) const -
2452{ -
2453 if (isEmptyHelper(d->qt_rgn) || isEmptyHelper(r.d->qt_rgn)
evaluated: isEmptyHelper(d->qt_rgn)
TRUEFALSE
yes
Evaluation Count:268
yes
Evaluation Count:150
evaluated: isEmptyHelper(r.d->qt_rgn)
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:145
5-268
2454 || !((&d->qt_rgn->extents)->right() >= (&r.d->qt_rgn->extents)->left() && (&d->qt_rgn->extents)->left() <= (&r.d->qt_rgn->extents)->right() && (&d->qt_rgn->extents)->bottom() >= (&r.d->qt_rgn->extents)->top() && (&d->qt_rgn->extents)->top() <= (&r.d->qt_rgn->extents)->bottom()))
partially evaluated: (&d->qt_rgn->extents)->right() >= (&r.d->qt_rgn->extents)->left()
TRUEFALSE
yes
Evaluation Count:145
no
Evaluation Count:0
evaluated: (&d->qt_rgn->extents)->left() <= (&r.d->qt_rgn->extents)->right()
TRUEFALSE
yes
Evaluation Count:144
yes
Evaluation Count:1
partially evaluated: (&d->qt_rgn->extents)->bottom() >= (&r.d->qt_rgn->extents)->top()
TRUEFALSE
yes
Evaluation Count:144
no
Evaluation Count:0
evaluated: (&d->qt_rgn->extents)->top() <= (&r.d->qt_rgn->extents)->bottom()
TRUEFALSE
yes
Evaluation Count:142
yes
Evaluation Count:2
0-145
2455 return QRegion();
executed: return QRegion();
Execution Count:276
276
2456 -
2457 -
2458 if (r.d->qt_rgn->contains(*d->qt_rgn))
evaluated: r.d->qt_rgn->contains(*d->qt_rgn)
TRUEFALSE
yes
Evaluation Count:33
yes
Evaluation Count:109
33-109
2459 return *this;
executed: return *this;
Execution Count:33
33
2460 -
2461 -
2462 if (d->qt_rgn->contains(*r.d->qt_rgn))
evaluated: d->qt_rgn->contains(*r.d->qt_rgn)
TRUEFALSE
yes
Evaluation Count:44
yes
Evaluation Count:65
44-65
2463 return r;
executed: return r;
Execution Count:44
44
2464 -
2465 if (r.d->qt_rgn->numRects == 1 && d->qt_rgn->numRects == 1) {
evaluated: r.d->qt_rgn->numRects == 1
TRUEFALSE
yes
Evaluation Count:29
yes
Evaluation Count:36
evaluated: d->qt_rgn->numRects == 1
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:26
3-36
2466 const QRect rect = qt_rect_intersect_normalized(r.d->qt_rgn->extents, -
2467 d->qt_rgn->extents); -
2468 return QRegion(rect);
executed: return QRegion(rect);
Execution Count:3
3
2469 } else if (r.d->qt_rgn->numRects == 1) {
evaluated: r.d->qt_rgn->numRects == 1
TRUEFALSE
yes
Evaluation Count:26
yes
Evaluation Count:36
26-36
2470 QRegion result(*this); -
2471 result.detach(); -
2472 result.d->qt_rgn->intersect(r.d->qt_rgn->extents); -
2473 return result;
executed: return result;
Execution Count:26
26
2474 } else if (d->qt_rgn->numRects == 1) {
evaluated: d->qt_rgn->numRects == 1
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:24
12-24
2475 QRegion result(r); -
2476 result.detach(); -
2477 result.d->qt_rgn->intersect(d->qt_rgn->extents); -
2478 return result;
executed: return result;
Execution Count:12
12
2479 } -
2480 -
2481 QRegion result; -
2482 result.detach(); -
2483 miRegionOp(*result.d->qt_rgn, d->qt_rgn, r.d->qt_rgn, miIntersectO, 0, 0); -
2484 miSetExtents(*result.d->qt_rgn); -
2485 return result;
executed: return result;
Execution Count:24
24
2486} -
2487 -
2488QRegion QRegion::intersected(const QRect &r) const -
2489{ -
2490 if (isEmptyHelper(d->qt_rgn) || r.isEmpty()
evaluated: isEmptyHelper(d->qt_rgn)
TRUEFALSE
yes
Evaluation Count:5647
yes
Evaluation Count:88481
evaluated: r.isEmpty()
TRUEFALSE
yes
Evaluation Count:522
yes
Evaluation Count:87959
522-88481
2491 || !((&d->qt_rgn->extents)->right() >= (&r)->left() && (&d->qt_rgn->extents)->left() <= (&r)->right() && (&d->qt_rgn->extents)->bottom() >= (&r)->top() && (&d->qt_rgn->extents)->top() <= (&r)->bottom()))
evaluated: (&d->qt_rgn->extents)->right() >= (&r)->left()
TRUEFALSE
yes
Evaluation Count:87956
yes
Evaluation Count:3
evaluated: (&d->qt_rgn->extents)->left() <= (&r)->right()
TRUEFALSE
yes
Evaluation Count:87951
yes
Evaluation Count:5
partially evaluated: (&d->qt_rgn->extents)->bottom() >= (&r)->top()
TRUEFALSE
yes
Evaluation Count:87951
no
Evaluation Count:0
evaluated: (&d->qt_rgn->extents)->top() <= (&r)->bottom()
TRUEFALSE
yes
Evaluation Count:87950
yes
Evaluation Count:1
0-87956
2492 return QRegion();
executed: return QRegion();
Execution Count:6178
6178
2493 -
2494 -
2495 if (d->qt_rgn->within(r))
evaluated: d->qt_rgn->within(r)
TRUEFALSE
yes
Evaluation Count:59863
yes
Evaluation Count:28087
28087-59863
2496 return *this;
executed: return *this;
Execution Count:59863
59863
2497 -
2498 -
2499 if (d->qt_rgn->contains(r))
evaluated: d->qt_rgn->contains(r)
TRUEFALSE
yes
Evaluation Count:23330
yes
Evaluation Count:4757
4757-23330
2500 return r;
executed: return r;
Execution Count:23330
23330
2501 -
2502 if (d->qt_rgn->numRects == 1) {
evaluated: d->qt_rgn->numRects == 1
TRUEFALSE
yes
Evaluation Count:650
yes
Evaluation Count:4107
650-4107
2503 const QRect rect = qt_rect_intersect_normalized(d->qt_rgn->extents, -
2504 r.normalized()); -
2505 return QRegion(rect);
executed: return QRegion(rect);
Execution Count:650
650
2506 } -
2507 -
2508 QRegion result(*this); -
2509 result.detach(); -
2510 result.d->qt_rgn->intersect(r); -
2511 return result;
executed: return result;
Execution Count:4107
4107
2512} -
2513 -
2514QRegion QRegion::subtracted(const QRegion &r) const -
2515{ -
2516 if (isEmptyHelper(d->qt_rgn) || isEmptyHelper(r.d->qt_rgn))
evaluated: isEmptyHelper(d->qt_rgn)
TRUEFALSE
yes
Evaluation Count:1221
yes
Evaluation Count:21375
evaluated: isEmptyHelper(r.d->qt_rgn)
TRUEFALSE
yes
Evaluation Count:2946
yes
Evaluation Count:18429
1221-21375
2517 return *this;
executed: return *this;
Execution Count:4167
4167
2518 if (r.d->qt_rgn->contains(*d->qt_rgn))
evaluated: r.d->qt_rgn->contains(*d->qt_rgn)
TRUEFALSE
yes
Evaluation Count:3022
yes
Evaluation Count:15407
3022-15407
2519 return QRegion();
executed: return QRegion();
Execution Count:3022
3022
2520 if (!((&d->qt_rgn->extents)->right() >= (&r.d->qt_rgn->extents)->left() && (&d->qt_rgn->extents)->left() <= (&r.d->qt_rgn->extents)->right() && (&d->qt_rgn->extents)->bottom() >= (&r.d->qt_rgn->extents)->top() && (&d->qt_rgn->extents)->top() <= (&r.d->qt_rgn->extents)->bottom()))
evaluated: (&d->qt_rgn->extents)->right() >= (&r.d->qt_rgn->extents)->left()
TRUEFALSE
yes
Evaluation Count:15375
yes
Evaluation Count:32
evaluated: (&d->qt_rgn->extents)->left() <= (&r.d->qt_rgn->extents)->right()
TRUEFALSE
yes
Evaluation Count:15348
yes
Evaluation Count:27
evaluated: (&d->qt_rgn->extents)->bottom() >= (&r.d->qt_rgn->extents)->top()
TRUEFALSE
yes
Evaluation Count:15302
yes
Evaluation Count:46
evaluated: (&d->qt_rgn->extents)->top() <= (&r.d->qt_rgn->extents)->bottom()
TRUEFALSE
yes
Evaluation Count:15148
yes
Evaluation Count:154
27-15375
2521 return *this;
executed: return *this;
Execution Count:259
259
2522 if (d == r.d || EqualRegion(d->qt_rgn, r.d->qt_rgn))
partially evaluated: d == r.d
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:15148
partially evaluated: EqualRegion(d->qt_rgn, r.d->qt_rgn)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:15148
0-15148
2523 return QRegion();
never executed: return QRegion();
0
2524 -
2525 -
2526 -
2527 -
2528 -
2529 -
2530 QRegion result; -
2531 result.detach(); -
2532 SubtractRegion(d->qt_rgn, r.d->qt_rgn, *result.d->qt_rgn); -
2533 -
2534 -
2535 -
2536 return result;
executed: return result;
Execution Count:15148
15148
2537} -
2538 -
2539QRegion QRegion::xored(const QRegion &r) const -
2540{ -
2541 if (isEmptyHelper(d->qt_rgn)) {
evaluated: isEmptyHelper(d->qt_rgn)
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:25
6-25
2542 return r;
executed: return r;
Execution Count:6
6
2543 } else if (isEmptyHelper(r.d->qt_rgn)) {
evaluated: isEmptyHelper(r.d->qt_rgn)
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:22
3-22
2544 return *this;
executed: return *this;
Execution Count:3
3
2545 } else if (!((&d->qt_rgn->extents)->right() >= (&r.d->qt_rgn->extents)->left() && (&d->qt_rgn->extents)->left() <= (&r.d->qt_rgn->extents)->right() && (&d->qt_rgn->extents)->bottom() >= (&r.d->qt_rgn->extents)->top() && (&d->qt_rgn->extents)->top() <= (&r.d->qt_rgn->extents)->bottom())) {
partially evaluated: (&d->qt_rgn->extents)->right() >= (&r.d->qt_rgn->extents)->left()
TRUEFALSE
yes
Evaluation Count:22
no
Evaluation Count:0
partially evaluated: (&d->qt_rgn->extents)->left() <= (&r.d->qt_rgn->extents)->right()
TRUEFALSE
yes
Evaluation Count:22
no
Evaluation Count:0
partially evaluated: (&d->qt_rgn->extents)->bottom() >= (&r.d->qt_rgn->extents)->top()
TRUEFALSE
yes
Evaluation Count:22
no
Evaluation Count:0
partially evaluated: (&d->qt_rgn->extents)->top() <= (&r.d->qt_rgn->extents)->bottom()
TRUEFALSE
yes
Evaluation Count:22
no
Evaluation Count:0
0-22
2546 return (*this + r);
never executed: return (*this + r);
0
2547 } else if (d == r.d || EqualRegion(d->qt_rgn, r.d->qt_rgn)) {
evaluated: d == r.d
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:19
partially evaluated: EqualRegion(d->qt_rgn, r.d->qt_rgn)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:19
0-19
2548 return QRegion();
executed: return QRegion();
Execution Count:3
3
2549 } else { -
2550 QRegion result; -
2551 result.detach(); -
2552 XorRegion(d->qt_rgn, r.d->qt_rgn, *result.d->qt_rgn); -
2553 return result;
executed: return result;
Execution Count:19
19
2554 } -
2555} -
2556 -
2557QRect QRegion::boundingRect() const -
2558{ -
2559 if (isEmpty())
evaluated: isEmpty()
TRUEFALSE
yes
Evaluation Count:3419
yes
Evaluation Count:75877
3419-75877
2560 return QRect();
executed: return QRect();
Execution Count:3419
3419
2561 return d->qt_rgn->extents;
executed: return d->qt_rgn->extents;
Execution Count:75877
75877
2562} -
2563 -
2564 -
2565 -
2566 -
2567 -
2568__attribute__((visibility("default"))) -
2569bool qt_region_strictContains(const QRegion &region, const QRect &rect) -
2570{ -
2571 if (isEmptyHelper(region.d->qt_rgn) || !rect.isValid())
evaluated: isEmptyHelper(region.d->qt_rgn)
TRUEFALSE
yes
Evaluation Count:35005
yes
Evaluation Count:122253
evaluated: !rect.isValid()
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:122240
13-122253
2572 return false;
executed: return false;
Execution Count:35018
35018
2573 const QRect r1 = region.d->qt_rgn->innerRect; -
2574 return (rect.left() >= r1.left() && rect.right() <= r1.right() 122240
2575 && rect.top() >= r1.top() && rect.bottom() <= r1.bottom());
executed: return (rect.left() >= r1.left() && rect.right() <= r1.right() && rect.top() >= r1.top() && rect.bottom() <= r1.bottom());
Execution Count:122240
122240
2576} -
2577 -
2578QVector<QRect> QRegion::rects() const -
2579{ -
2580 if (d->qt_rgn) {
partially evaluated: d->qt_rgn
TRUEFALSE
yes
Evaluation Count:60416
no
Evaluation Count:0
0-60416
2581 d->qt_rgn->vectorize(); -
2582 d->qt_rgn->rects.reserve(d->qt_rgn->numRects); -
2583 d->qt_rgn->rects.resize(d->qt_rgn->numRects); -
2584 return d->qt_rgn->rects;
executed: return d->qt_rgn->rects;
Execution Count:60416
60416
2585 } else { -
2586 return QVector<QRect>();
never executed: return QVector<QRect>();
0
2587 } -
2588} -
2589 -
2590void QRegion::setRects(const QRect *rects, int num) -
2591{ -
2592 *this = QRegion(); -
2593 if (!rects || num == 0 || (num == 1 && rects->isEmpty()))
evaluated: !rects
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:31
evaluated: num == 0
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:30
evaluated: num == 1
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:25
evaluated: rects->isEmpty()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:4
1-31
2594 return;
executed: return;
Execution Count:3
3
2595 -
2596 detach(); -
2597 -
2598 d->qt_rgn->numRects = num; -
2599 if (num == 1) {
evaluated: num == 1
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:25
4-25
2600 d->qt_rgn->extents = *rects; -
2601 d->qt_rgn->innerRect = *rects; -
2602 } else {
executed: }
Execution Count:4
4
2603 d->qt_rgn->rects.resize(num); -
2604 -
2605 int left = 2147483647, -
2606 right = (-2147483647 - 1), -
2607 top = 2147483647, -
2608 bottom = (-2147483647 - 1); -
2609 for (int i = 0; i < num; ++i) {
evaluated: i < num
TRUEFALSE
yes
Evaluation Count:59
yes
Evaluation Count:25
25-59
2610 const QRect &rect = rects[i]; -
2611 d->qt_rgn->rects[i] = rect; -
2612 left = qMin(rect.left(), left); -
2613 right = qMax(rect.right(), right); -
2614 top = qMin(rect.top(), top); -
2615 bottom = qMax(rect.bottom(), bottom); -
2616 d->qt_rgn->updateInnerRect(rect); -
2617 }
executed: }
Execution Count:59
59
2618 d->qt_rgn->extents = QRect(QPoint(left, top), QPoint(right, bottom)); -
2619 }
executed: }
Execution Count:25
25
2620} -
2621 -
2622int QRegion::rectCount() const -
2623{ -
2624 return (d->qt_rgn ? d->qt_rgn->numRects : 0);
executed: return (d->qt_rgn ? d->qt_rgn->numRects : 0);
Execution Count:48459
48459
2625} -
2626 -
2627 -
2628bool QRegion::operator==(const QRegion &r) const -
2629{ -
2630 if (!d->qt_rgn)
partially evaluated: !d->qt_rgn
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:698
0-698
2631 return r.isEmpty();
never executed: return r.isEmpty();
0
2632 if (!r.d->qt_rgn)
partially evaluated: !r.d->qt_rgn
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:698
0-698
2633 return isEmpty();
never executed: return isEmpty();
0
2634 -
2635 if (d == r.d)
evaluated: d == r.d
TRUEFALSE
yes
Evaluation Count:189
yes
Evaluation Count:509
189-509
2636 return true;
executed: return true;
Execution Count:189
189
2637 else -
2638 return EqualRegion(d->qt_rgn, r.d->qt_rgn);
executed: return EqualRegion(d->qt_rgn, r.d->qt_rgn);
Execution Count:509
509
2639} -
2640 -
2641bool QRegion::intersects(const QRect &rect) const -
2642{ -
2643 if (isEmptyHelper(d->qt_rgn) || rect.isNull())
evaluated: isEmptyHelper(d->qt_rgn)
TRUEFALSE
yes
Evaluation Count:8129
yes
Evaluation Count:16650
partially evaluated: rect.isNull()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:16650
0-16650
2644 return false;
executed: return false;
Execution Count:8129
8129
2645 -
2646 const QRect r = rect.normalized(); -
2647 if (!rect_intersects(d->qt_rgn->extents, r))
evaluated: !rect_intersects(d->qt_rgn->extents, r)
TRUEFALSE
yes
Evaluation Count:1023
yes
Evaluation Count:15627
1023-15627
2648 return false;
executed: return false;
Execution Count:1023
1023
2649 if (d->qt_rgn->numRects == 1)
evaluated: d->qt_rgn->numRects == 1
TRUEFALSE
yes
Evaluation Count:13444
yes
Evaluation Count:2183
2183-13444
2650 return true;
executed: return true;
Execution Count:13444
13444
2651 -
2652 const QVector<QRect> myRects = rects(); -
2653 for (QVector<QRect>::const_iterator it = myRects.constBegin(); it < myRects.constEnd(); ++it)
evaluated: it < myRects.constEnd()
TRUEFALSE
yes
Evaluation Count:3712
yes
Evaluation Count:709
709-3712
2654 if (rect_intersects(r, *it))
evaluated: rect_intersects(r, *it)
TRUEFALSE
yes
Evaluation Count:1474
yes
Evaluation Count:2238
1474-2238
2655 return true;
executed: return true;
Execution Count:1474
1474
2656 return false;
executed: return false;
Execution Count:709
709
2657} -
2658 -
2659 -
2660 -
2661 -
2662 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial