qbsptree.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/widgets/itemviews/qbsptree.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4QBspTree::QBspTree() : depth(6), visited(0) {}
never executed: end of block
0
5-
6void QBspTree::create(int n, int d)-
7{-
8-
9 if (d == -1
d == -1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
10 int c;-
11 for (c = 0; n
nDescription
TRUEnever evaluated
FALSEnever evaluated
; ++c)
0
12 n = n / 10;
never executed: n = n / 10;
0
13 depth = c << 1;-
14 }
never executed: end of block
else {
0
15 depth = d;-
16 }
never executed: end of block
0
17 depth = qMax(depth, uint(1));-
18-
19 nodes.resize((1 << depth) - 1);-
20 leaves.resize(1 << depth);-
21}
never executed: end of block
0
22-
23void QBspTree::destroy()-
24{-
25 leaves.clear();-
26 nodes.clear();-
27}
never executed: end of block
0
28-
29void QBspTree::climbTree(const QRect &rect, callback *function, QBspTreeData data)-
30{-
31 if (nodes.isEmpty()
nodes.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
32 return;
never executed: return;
0
33 ++visited;-
34 climbTree(rect, function, data, 0);-
35}
never executed: end of block
0
36-
37void QBspTree::climbTree(const QRect &area, callback *function, QBspTreeData data, int index)-
38{-
39 if (index >= nodes.count()
index >= nodes.count()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
40 ((!(!nodes.isEmpty())) ? qt_assert("!nodes.isEmpty()",__FILE__,80) : qt_noop());-
41 function(leaf(index - nodes.count()), area, visited, data);-
42 return;
never executed: return;
0
43 }-
44-
45 Node::Type t = (Node::Type) nodes.at(index).type;-
46-
47 int pos = nodes.at(index).pos;-
48 int idx = firstChildIndex(index);-
49 if (t == Node::VerticalPlane
t == Node::VerticalPlaneDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
50 if (area.left() < pos
area.left() < posDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
51 climbTree(area, function, data, idx);
never executed: climbTree(area, function, data, idx);
0
52 if (area.right() >= pos
area.right() >= posDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
53 climbTree(area, function, data, idx + 1);
never executed: climbTree(area, function, data, idx + 1);
0
54 }
never executed: end of block
else {
0
55 if (area.top() < pos
area.top() < posDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
56 climbTree(area, function, data, idx);
never executed: climbTree(area, function, data, idx);
0
57 if (area.bottom() >= pos
area.bottom() >= posDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
58 climbTree(area, function, data, idx + 1);
never executed: climbTree(area, function, data, idx + 1);
0
59 }
never executed: end of block
0
60}-
61-
62void QBspTree::init(const QRect &area, int depth, NodeType type, int index)-
63{-
64 Node::Type t = Node::None;-
65 if (type == Node::Both
type == Node::BothDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
66 t = (
(depth & 1)Description
TRUEnever evaluated
FALSEnever evaluated
depth & 1)
(depth & 1)Description
TRUEnever evaluated
FALSEnever evaluated
? Node::HorizontalPlane : Node::VerticalPlane;
never executed: t = (depth & 1) ? Node::HorizontalPlane : Node::VerticalPlane;
0
67 else-
68 t = type;
never executed: t = type;
0
69 QPoint center = area.center();-
70 nodes[index].pos = (t == Node::VerticalPlane
t == Node::VerticalPlaneDescription
TRUEnever evaluated
FALSEnever evaluated
? center.x() : center.y());
0
71 nodes[index].type = t;-
72-
73 QRect front = area;-
74 QRect back = area;-
75-
76 if (t == Node::VerticalPlane
t == Node::VerticalPlaneDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
77 front.setLeft(center.x());-
78 back.setRight(center.x() - 1);-
79 }
never executed: end of block
else {
0
80 front.setTop(center.y());-
81 back.setBottom(center.y() - 1);-
82 }
never executed: end of block
0
83-
84 int idx = firstChildIndex(index);-
85 if (--
--depthDescription
TRUEnever evaluated
FALSEnever evaluated
depth
--depthDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
86 init(back, depth, type, idx);-
87 init(front, depth, type, idx + 1);-
88 }
never executed: end of block
0
89}
never executed: end of block
0
90-
91void QBspTree::insert(QVector<int> &leaf, const QRect &, uint, QBspTreeData data)-
92{-
93 leaf.append(data.i);-
94}
never executed: end of block
0
95-
96void QBspTree::remove(QVector<int> &leaf, const QRect &, uint, QBspTreeData data)-
97{-
98 int i = leaf.indexOf(data.i);-
99 if (i != -1
i != -1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
100 leaf.remove(i);
never executed: leaf.remove(i);
0
101}
never executed: end of block
0
102-
103-
Switch to Source codePreprocessed file

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