| Line | Source Code | Coverage |
|---|
| 1 | | - |
| 2 | | - |
| 3 | | - |
| 4 | QBspTree::QBspTree() : depth(6), visited(0) {} executed: }Execution Count:16 | 16 |
| 5 | | - |
| 6 | void QBspTree::create(int n, int d) | - |
| 7 | { | - |
| 8 | | - |
| 9 | if (d == -1) { partially evaluated: d == -1| yes Evaluation Count:15 | no Evaluation Count:0 |
| 0-15 |
| 10 | int c; | - |
| 11 | for (c = 0; n; ++c) evaluated: n| yes Evaluation Count:20 | yes Evaluation Count:15 |
| 15-20 |
| 12 | n = n / 10; executed: n = n / 10;Execution Count:20 | 20 |
| 13 | depth = c << 1; | - |
| 14 | } else { executed: }Execution Count:15 | 15 |
| 15 | depth = d; | - |
| 16 | } | 0 |
| 17 | depth = qMax(depth, uint(1)); | - |
| 18 | | - |
| 19 | nodes.resize((1 << depth) - 1); | - |
| 20 | leaves.resize(1 << depth); | - |
| 21 | } executed: }Execution Count:15 | 15 |
| 22 | | - |
| 23 | void QBspTree::destroy() | - |
| 24 | { | - |
| 25 | leaves.clear(); | - |
| 26 | nodes.clear(); | - |
| 27 | } executed: }Execution Count:247 | 247 |
| 28 | | - |
| 29 | void QBspTree::climbTree(const QRect &rect, callback *function, QBspTreeData data) | - |
| 30 | { | - |
| 31 | if (nodes.isEmpty()) partially evaluated: nodes.isEmpty()| no Evaluation Count:0 | yes Evaluation Count:168 |
| 0-168 |
| 32 | return; | 0 |
| 33 | ++visited; | - |
| 34 | climbTree(rect, function, data, 0); | - |
| 35 | } executed: }Execution Count:168 | 168 |
| 36 | | - |
| 37 | void QBspTree::climbTree(const QRect &area, callback *function, QBspTreeData data, int index) | - |
| 38 | { | - |
| 39 | if (index >= nodes.count()) { evaluated: index >= nodes.count()| yes Evaluation Count:1213 | yes Evaluation Count:2851 |
| 1213-2851 |
| 40 | qt_noop(); | - |
| 41 | function(leaf(index - nodes.count()), area, visited, data); | - |
| 42 | return; executed: return;Execution Count:1213 | 1213 |
| 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) { evaluated: t == Node::VerticalPlane| yes Evaluation Count:1184 | yes Evaluation Count:1667 |
| 1184-1667 |
| 50 | if (area.left() < pos) evaluated: area.left() < pos| yes Evaluation Count:863 | yes Evaluation Count:321 |
| 321-863 |
| 51 | climbTree(area, function, data, idx); executed: climbTree(area, function, data, idx);Execution Count:863 | 863 |
| 52 | if (area.right() >= pos) evaluated: area.right() >= pos| yes Evaluation Count:546 | yes Evaluation Count:638 |
| 546-638 |
| 53 | climbTree(area, function, data, idx + 1); executed: climbTree(area, function, data, idx + 1);Execution Count:546 | 546 |
| 54 | } else { executed: }Execution Count:1184 | 1184 |
| 55 | if (area.top() < pos) evaluated: area.top() < pos| yes Evaluation Count:1226 | yes Evaluation Count:441 |
| 441-1226 |
| 56 | climbTree(area, function, data, idx); executed: climbTree(area, function, data, idx);Execution Count:1226 | 1226 |
| 57 | if (area.bottom() >= pos) evaluated: area.bottom() >= pos| yes Evaluation Count:734 | yes Evaluation Count:933 |
| 734-933 |
| 58 | climbTree(area, function, data, idx + 1); executed: climbTree(area, function, data, idx + 1);Execution Count:734 | 734 |
| 59 | } executed: }Execution Count:1667 | 1667 |
| 60 | } | - |
| 61 | | - |
| 62 | void QBspTree::init(const QRect &area, int depth, NodeType type, int index) | - |
| 63 | { | - |
| 64 | Node::Type t = Node::None; | - |
| 65 | if (type == Node::Both) evaluated: type == Node::Both| yes Evaluation Count:142 | yes Evaluation Count:27 |
| 27-142 |
| 66 | t = (depth & 1) ? Node::HorizontalPlane : Node::VerticalPlane; executed: t = (depth & 1) ? Node::HorizontalPlane : Node::VerticalPlane;Execution Count:142 evaluated: (depth & 1)| yes Evaluation Count:95 | yes Evaluation Count:47 |
| 47-142 |
| 67 | else | - |
| 68 | t = type; executed: t = type;Execution Count:27 | 27 |
| 69 | QPoint center = area.center(); | - |
| 70 | nodes[index].pos = (t == Node::VerticalPlane ? center.x() : center.y()); evaluated: t == Node::VerticalPlane| yes Evaluation Count:50 | yes Evaluation Count:119 |
| 50-119 |
| 71 | nodes[index].type = t; | - |
| 72 | | - |
| 73 | QRect front = area; | - |
| 74 | QRect back = area; | - |
| 75 | | - |
| 76 | if (t == Node::VerticalPlane) { evaluated: t == Node::VerticalPlane| yes Evaluation Count:50 | yes Evaluation Count:119 |
| 50-119 |
| 77 | front.setLeft(center.x()); | - |
| 78 | back.setRight(center.x() - 1); | - |
| 79 | } else { executed: }Execution Count:50 | 50 |
| 80 | front.setTop(center.y()); | - |
| 81 | back.setBottom(center.y() - 1); | - |
| 82 | } executed: }Execution Count:119 | 119 |
| 83 | | - |
| 84 | int idx = firstChildIndex(index); | - |
| 85 | if (--depth) { evaluated: --depth| yes Evaluation Count:76 | yes Evaluation Count:93 |
| 76-93 |
| 86 | init(back, depth, type, idx); | - |
| 87 | init(front, depth, type, idx + 1); | - |
| 88 | } executed: }Execution Count:76 | 76 |
| 89 | } executed: }Execution Count:169 | 169 |
| 90 | | - |
| 91 | void QBspTree::insert(QVector<int> &leaf, const QRect &, uint, QBspTreeData data) | - |
| 92 | { | - |
| 93 | leaf.append(data.i); | - |
| 94 | } executed: }Execution Count:872 | 872 |
| 95 | | - |
| 96 | void QBspTree::remove(QVector<int> &leaf, const QRect &, uint, QBspTreeData data) | - |
| 97 | { | - |
| 98 | int i = leaf.indexOf(data.i); | - |
| 99 | if (i != -1) partially evaluated: i != -1| yes Evaluation Count:11 | no Evaluation Count:0 |
| 0-11 |
| 100 | leaf.remove(i); executed: leaf.remove(i);Execution Count:11 | 11 |
| 101 | } executed: }Execution Count:11 | 11 |
| 102 | | - |
| 103 | | - |
| 104 | | - |
| | |