qregion.cpp

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

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9